Skip to reading
Buttons, Labels & Text Boxes

17. Change a control during gameplay

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

Use the shared GUI actions when an element needs to change during play. Give an explicit GUI ID and element ID for these examples.

Source table from 17. Change a control during gameplay, page 39
TaskAction or property
Show/hide the whole panelShow GUI / Hide GUI
Show/hide a particular controlShow GUI Element / Hide GUI Element
Keep a button visible but unavailableDisable GUI Element; Enable GUI Element restores it.
Change a label or button captionChange GUI Element Property: text
Fill or clear a text boxChange GUI Element Property: value
Change temporary hover artworkChange GUI Element Property: hoverImageAssetId
Change one cornerChange GUI Element Property: radiusTopLeft, or the corresponding corner key.
Code example
await ChangeGUIElementProperty({
    "guiId": "register_panel",
    "elementId": "register_feedback",
    "property": "text",
    "value": "The keeper has closed the register."
})

If the feedback label originally contained $$feedback, replacing its text with this fixed sentence removes that token from the running element. Change the feedback variable instead when you want to preserve the live binding.

Runtime changes do not rewrite the saved authoring layout. Rebuilding a text box to change one of its definition properties can also replace its current draft. Store important entered text before an operation that recreates that control.

Page 39 of 46Permalink
Go to page