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
Next revisionBoth sides next revision
widget [2020/11/27 09:49] justinwidget [2020/12/01 15:16] justin
Line 4: Line 4:
 A **widget** is a UI component such as the [[inventory]] window or [[item container]] window. A widget's layout is grid-based and contains child elements that either display information to the player (e.g. the player's health or description of a quest) or allow the player to interact with them (e.g. a button that triggers a [[script]] or a slot for placing an [[item]] into). Custom widgets can be created in the [[Widget Editor]]. A **widget** is a UI component such as the [[inventory]] window or [[item container]] window. A widget's layout is grid-based and contains child elements that either display information to the player (e.g. the player's health or description of a quest) or allow the player to interact with them (e.g. a button that triggers a [[script]] or a slot for placing an [[item]] into). Custom widgets can be created in the [[Widget Editor]].
  
-{{:wiki:inventory.png?nolink|}}+<WRAP center round info 100%> 
 +Custom widgets can be displayed in-game using the [[Show Widget]] scripting functionYou can also add them to the [[management screen]] by adding their IDs to the comma-separated list of widgets in the "Experimental" section of your [[Game Configuration]]. 
 +</WRAP> 
 + 
 +=====Scripting===== 
 +The following example scripts assume there is a [[widget]] with an ID of "test", and the [[widget]] has a [[text field]] with an ID of "0001" and [[button]] with an ID of "0002".  
 + 
 +This script will close the [[widget]] and store the text that was entered into the [[text field]]. 
 +<code bauxite> 
 +hide_widget("test"); 
 +$name = widget["test"].element["0001"].text; 
 +display_message("Hello, " + $name + "!"
 +</code> 
 + 
 +This script will change the text of the [[button]] to now be "New Text"
 +<code bauxite> 
 +widget["test"].element["0002"].text = "New Text" 
 +</code>
  
 ~~NOTOC~~ ~~NOTOC~~
widget.txt · Last modified: 2021/04/21 20:24 by justin