[SOLVED] how to check if task is running?

I want to disable base.accept(“enter”, function) while a task is running. How can i do that?

  1. stop responding to that event temporarily :
    a. base.ignore(“enter”) before starting the task
    b. reaccept it when the task ends

  2. 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():
    # 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.