I maybe found the problem behind some problems reported in my questions thread.
If I remove tasks from the task manager they usually trigger an uponDeath function and that works fine. Now I got situations where I want to remove tasks from the manager without triggering the uponDeath function. Reading Task.py line 416+ I wonder if that’s possible?
Edit: or maybe it’s the taskMgr.getTask(‘foo’) you’re missing. There’s no such method, because there might be multiple tasks with the same name; instead, there’s taskMgr.getTasksNamed(‘foo’), which returns a list. If you’re confident there’s only one task named ‘foo’, you can just get the first element of that list.
Or, you can save the Task object that is returned when you create the task in the first place.
@ ynjh_jo didn’t catch the context of what you said.
Yeah I did:
for thistask in taskMgr.getTasksNamed(task):
where task is the name of the task(s) that I used for AI stuff. I still try to understand what the problem is when i get back to the menu or land on a planet - all ships get deleted and then some task comes back, wants to do an operation on the nodes, but those are already removed. But I first remove the tasks, then the nodes, so there should be no problem.
ynjh_jo meant to pass setUponDeath(None) instead of setUponDeath(lambda: 0).
Well, what can I say to this? This sounds like a logic error somewhere in your code. Perhaps you have not deleted the appropriate task; or perhaps your task has a pointer to the wrong node. Also note that when a task removes itself (e.g. in a nested call), it doesn’t interrupt its current frame–it continues to run until it returns task.whatever.
Yes, that’s what it means.
No, none of those can change an existing interval to None. Nothing can, sort of reassigning into the list. So this means one of three things:
(1) You are reassigning None into the list, with e.g. myintlist = None
(2) Your added None into the list in the first place without realizing it. Not possible with the code snippet you posted, but maybe some of your code looks different than that.
(3) The interval is not in fact None, but is just something that says “None” when you print it. I don’t know of any intervals that do this, though.