IdaJS
    Preparing search index...

    Variable doAction

    doAction: (callback: () => void) => () => void

    [COROUTINE COMMAND] Use in the coroutines only; Must be called with yield!

    Executes an external action from within a coroutine.

    Always use this to do any side effects from the coroutines: to change classic game variables, start other coroutines, or perform other side effects.

    Wrapping the side effect to the doAction call, ensures that it will not be repeat each time the coroutine is resumed from the saved game, but only once when the coroutine reaches this point.

    Type Declaration

      • (callback: () => void): () => void
      • Parameters

        • callback: () => void

          The action to execute

        Returns () => void

    See also special helpers for changing IdaJS variable stores. You can use them instead of doAction when changing the stored variables:

    • doGameStore - to change IdaJS game store variables from within a coroutine
    • doSceneStore - to change IdaJS scene store variables from within a coroutine
    // Coroutine function (must have * after function keyword)
    function* myCoroutine() {
    // Some other coroutine commands...

    // Change the classic LBA2 game variable #40 to have value 5, from within the coroutine
    yield doAction(() => scene.setGameVariable(40, 5));
    }