Skip to reading
BASIC Scripting

Let the engine call your script

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 illustrations

BASIC IN YOUR GAME

An event is the game telling you something happened. A room-arrival handler can read which room just loaded without checking the room every frame.

OnSceneLoaded is checked for the Room Notice record in the BASIC Designer.

Code example
SUB OnSceneLoaded(context AS Dictionary)
    PRINT "Arrived in " & context.sceneId
END SUB

01. Open the BASIC record, check OnSceneLoaded under Event Functions, enter the matching SUB, then apply and save. The editor’s upper record fields identify this handler as room_notice.

02. Start or enter a room. In the recorded preview, the room’s ID was lab and the output read Arrived in lab. The player-facing room name can be completely different.

context is a dictionary of details for this event. A scene event can supply sceneId. Other events supply different details. To inspect what actually arrived, put PRINT context inside the SUB and trigger the event in the game.

Page 24 of 86Permalink
Go to page