This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| widget [2020/11/27 09:45] – justin | widget [2021/04/21 20:24] (current) – justin | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ---- | ---- | ||
| - | A **widget** is a UI component such as the [[inventory]] window or [[item container]] window. A widget' | + | A **widget** is a UI component such as the [[inventory]] window or [[item container]] window. A widget' |
| - | {{: | + | <WRAP center round info 100%> |
| + | Custom widgets can be displayed in-game using the [[Show Widget]] scripting function. You can also add them to the [[management screen]] by adding their IDs to the comma-separated list of widgets in the " | ||
| + | </ | ||
| + | |||
| + | =====Scripting===== | ||
| + | You can access and change certain element properties from within a [[script]] by simply referencing the parent [[widget]] and the child element by their unique IDs. The following example code assumes there is a [[widget]] with an ID of " | ||
| + | |||
| + | This script will close the [[widget]], store the text that was entered into the [[text field]] into a variable, then display a message to the player using their name. | ||
| + | <code bauxite> | ||
| + | hide_widget(" | ||
| + | $name = widget[" | ||
| + | display_message(" | ||
| + | </ | ||
| + | |||
| + | This script will change the text of the [[button]] to "New Text" | ||
| + | <code bauxite> | ||
| + | widget[" | ||
| + | </ | ||
| ~~NOTOC~~ | ~~NOTOC~~ | ||