User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
widget [2020/11/28 17:47]
widget [2021/04/21 20:24]
Line 9: Line 9:
 =====Scripting===== =====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 "test", and it contains a [[text field]] with an ID of "0001" and a [[button]] with an ID of "0002"
-(Showing/hiding widgets)+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> 
 +$name = widget["test"].element["0001"].text; 
 +display_message("Hello, " + $name + "!"); 
-(Accessing elements within a widget to change them or get a value from them)+This script will change the text of the [[button]] to "New Text"
 +<code bauxite> 
 +widget["test"].element["0002"].text = "New Text"; 
 ~~NOTOC~~ ~~NOTOC~~
widget.txt · Last modified: 2021/04/21 20:24 by justin