I want to disable base.accept(“enter”, function) while a task is running. How can i do that?
-
stop responding to that event temporarily :
a. base.ignore(“enter”) before starting the task
b. reaccept it when the task ends -
alter buttons-names temporarily :
a. base.buttonThrowers[0].node().setPrefix(“anyprefix-”)
The “enter” event would be “anyprefix-enter”. If during the task lifetime, you need to accept any event, please respect that prefix you set.
b. setPrefix("") when the task ends
In my case it would be like this ?:
def Enter():
base.ignore('enter')
# task here
base.accept('enter', Enter)
base.accept('enter', Enter)
EDIT:Oh, it is. I had another problem, this works
Only you know when the task ends. Basically, it’s considered done if it returns Task.done or None, or if it’s removed explicitly.