Skip to reading
Lua Scripting

Find the first thing that went wrong

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

READING GAME FEEDBACK

A button can respond, show the right message, and still leave a door closed. Check each piece in the order the game uses it.

The label shows a hint after the player enters east.  The same label shows a different reply for WeSt.
Source table from Find the first thing that went wrong, page 12
Nothing happensPlace a Log call at the start of run. If it never appears, check the Click Target and the record’s enabled setting.
Every entry looks blankCheck the GUI ID, the text-box ID and the property name text. Log the raw value inside square brackets to make extra spaces visible.
The label changes, but the door stays closedLook at the condition the door reads. Changing label text does not write a Boolean. Check that the code sets the same variable ID that the door reads.
Progress disappears after loadingSee where the value was stored. A local variable belongs to a script invocation or instance. Keep progress that belongs in a save slot in a PCA game variable.
Code example
Log("Read [" .. tostring(raw) .. "]")

Place this fragment immediately after reading the text box. Seeing Read [ WeSt ] confirms the text reached Lua. Next, log the cleaned answer to check the comparison.

Lua scripting   /   Illustrated guide                                                          W12
Page 12 of 133Permalink
Go to page