Skip to reading
Buttons, Labels & Text Boxes

4. Display a live variable

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

A variable holds a game value. A wildcard in a label or button caption displays that value. Use two dollar signs followed immediately by the exact variable ID.

Source table from 4. Display a live variable, page 10
Create this variableTypeStarting value
scoreNumber0
visitor_nameStringNo visitor yet
feedbackStringEnter CLOCK to unlock the register.
objectiveStringRead the register and enter a visitor name.
register_openBooleanfalse
notes_savedStringNothing saved yet.
visitsNumber1

1. Create the variables in Variable Designer and save.

2. Set Register Visitor's Text to Visitor: $$visitor_name.

3. Set Register Status's Text to Score: $$score | Visits: {visits}.

4. Set Register Feedback's Text to $$feedback.

5. Run the game. The labels should display the starting values, not the raw tokens.

A button caption can use the same text expansion. Add a point ($$score) shows the current score inside the button. Changing the caption does not itself award a point; the event supplies that action.

Use the variable ID, not its display name. $$Visitor Name is not the same expression as $$visitor_name. The token ends at a character outside letters, numbers and underscore.

Page 10 of 46Permalink
Go to page