Remember a yes or no
On this page
GAME VARIABLES
Has the player met the stationmaster? Has someone opened the archive? Each question has just two answers. A Boolean variable is a natural fit.
The inspector shows a Boolean named archive_open. The unchecked Initial Boolean Value means it starts false.
Set the starting value#
In Variable Designer, give the variable an ID. Select Boolean for Value Type. Leave Leave Blank At Start unchecked when the game should know the answer from the first frame. The Initial Boolean Value checkbox then sets that answer.
Change it during play#
await(SetVariable({ name = "archive_open", value = true }))This fragment goes inside a function. Once the game runs this line, another script can ask about the same variable by ID.
Read it somewhere else#
if IfVariable("archive_open", true) then
Log("The bolt is open.")
endKeep IDs consistent in both places. A player can see the word “Archive” on a door even when the underlying variable has a completely different name.
Lua scripting / Illustrated guide W09
