User Tools

Site Tools


widget

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
widget [2020/12/01 15:44] justinwidget [2021/04/21 20:24] (current) justin
Line 11: Line 11:
 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" 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"
  
-This script will close the [[widget]] and store the text that was entered into the [[text field]].+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> <code bauxite>
 hide_widget("test"); hide_widget("test");
 $name = widget["test"].element["0001"].text; $name = widget["test"].element["0001"].text;
-display_message("Hello, " + $name + "!")+display_message("Hello, " + $name + "!");
 </code> </code>
  
 This script will change the text of the [[button]] to "New Text". This script will change the text of the [[button]] to "New Text".
 <code bauxite> <code bauxite>
-widget["test"].element["0002"].text = "New Text"+widget["test"].element["0002"].text = "New Text";
 </code> </code>
  
 ~~NOTOC~~ ~~NOTOC~~
widget.1606866283.txt.gz · Last modified: 2020/12/01 15:44 by justin