Skip to reading
BASIC Scripting

Let two cues overlap

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

BASIC IN YOUR GAME

A bell and a whistle can start on different beats while the same script waits for both to finish.

Code example
FUNCTION Run()
    PARALLEL
        WAIT 0.05
        PRINT "Bell"
    BRANCH
        WAIT 0.1
        PRINT "Whistle"
    END PARALLEL
    RETURN "Both finished"
END FUNCTION

The first branch waits 0.05 seconds, then prints Bell. The second starts alongside it, waits 0.1 seconds, then prints Whistle. After both finish, the function returns Both finished.

Source table from Let two cues overlap, page 21
AWAITMarks a gameplay call that waits for completion. BASIC also waits for gameplay calls automatically. Check action options such as wait or waitForContinue when choosing when that action finishes.
BRANCHKeeps the statements in one branch in sequence. Without BRANCH, each statement directly inside PARALLEL starts independently.
Shared dataEach branch has its own local values. An assignment there does not update the parent’s local variable. Avoid having two branches change the same global counter at once.
Page 21 of 86Permalink
Go to page