4. Display a live variable
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.
| Create this variable | Type | Starting value |
|---|---|---|
| score | Number | 0 |
| visitor_name | String | No visitor yet |
| feedback | String | Enter CLOCK to unlock the register. |
| objective | String | Read the register and enter a visitor name. |
| register_open | Boolean | false |
| notes_saved | String | Nothing saved yet. |
| visits | Number | 1 |
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.
