Skip to reading
Visual Scripting in Depth

54. Update HUD text and use wildcards

Edition 0.86.4.3

0.86.4.3 edition with revised lessons, updated cross-references and new cinematic/camera-safety supplements. Earlier examples, screenshots and registry figures retain their stated edition context.

Download PDFView illustrations

Figure 35. The custom-event listener updates the HUD label while the game is running.

1. Add a label to scene_hud and give it a stable ID such as hud_text.

2. For a score display, enter WORKSHOP | Score: $$score in its text.

3. Use Add Score or Change Variable to change score during play.

4. For an explicit message, add Change GUI Element Property. Choose scene_hud, element hud_text, property text and the new text value.

5. Call it from the filtered custom-event listener.

6. Check the runtime label after the event.

A wildcard in an element’s displayed text is different from a graph expression in a JSON field. $$score asks the text system to display that variable. {"$var":"score"} asks the graph to resolve a value for an action or comparison.

Use the GUI and element dropdowns to avoid addressing the wrong label. An element ID is local to the authored GUI workflow; the containing GUI reference matters when selecting a target.

Do not paste the literal characters $$score into a numeric action parameter and expect a number. Use the value-expression syntax for that parameter.

Page 58 of 93Permalink
Go to page