Skip to reading
BASIC Scripting

Track down a runtime problem

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 script can pass validation and still receive a value that makes no sense for your game. If a ticket count must be zero or greater, say so in the code.

Code example
FUNCTION Run()
    DIM count = -1
    TRY
        ASSERT count >= 0
        RETURN "Ready"
    CATCH problem
        RETURN "Check the count"
    END TRY
END FUNCTION

ASSERT checks the expression. With count at -1, the check fails and control moves to CATCH. The code returns Check the count. With a nonnegative count it returns Ready. The name problem holds the failure details.

Source table from Track down a runtime problem, page 31
The script will not validateStart with the reported line and the line before it. Check quotes, closing parentheses and matching block endings.
No visible resultPRINT goes to the output. For a player-facing response, change a visible GUI label or call ShowMessage.
A click seems deadCheck that the GUI is visible, the button is enabled, its Click target is the script ID and the script is enabled. Start Run with a short PRINT to see whether the click got that far.
An event never arrivesCheck the subscription box, the matching handler name and whether the event actually occurred after the listener was available.
Page 31 of 86Permalink
Go to page