19. Fill a list from an Array
Use an Array source when game data should decide which rows exist. For example, a clue list can grow as the player learns things, while the GUI keeps the same layout.
1. Create an Array variable named clue_rows. Give it the object records below as its initial value.
2. Select the List Box. Set Item Source to array and Array Variable ID to clue_rows.
3. Use a different variable, selected_array, for Selected Item Variable. Make that a String for a single-select list.
4. Start a game preview and check that the rows appear.
[
{"id": "bell", "text": "The bell rang at midnight"},
{"id": "window", "text": "The upper window was open"},
{"id": "oil", "text": "Oil on the workshop floor"}
]Figure 28. Array Variable ID points to the source Array. Selected Item Variable is still a separate output.
Use a real Array value. A String containing quoted JSON is still a String; it is not the same data type.
