User Tools

Site Tools


button

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
button [2020/11/30 17:44] justinbutton [2021/04/21 20:12] justin
Line 2: Line 2:
 ---- ----
  
-A *button* is a clickable [[widget]] element that can be configured to run a [[script]], close the parent [[widget]], or craft [[item|items]] placed into [[crafting_input_slot|crafting input slots]].+**button** is a clickable [[widget]] element that can be configured to run a [[script]], close the parent [[widget]], craft a new [[item]] into a [[item_storage_slot|storage slot]] using any populated [[crafting_input_slot|input slots]], or craft a specific [[item]] using the player's [[inventory]].
  
 =====Element Properties===== =====Element Properties=====
 ^Icon^Property^Description^ ^Icon^Property^Description^
 +|{{:wiki:tag_id.png?nolink|}}|Element ID|ID for the button. This ID must be unique amongst other elements within the same [[widget]]. It is currently auto-generated but will be editable in a future update.|
 |{{:wiki:button.png?nolink|}}|Button Type|Determines whether the button will have standard behavior or if it will behave as a toggle button (i.e. the button toggles between an "on" and "off" state each time it's pressed).| |{{:wiki:button.png?nolink|}}|Button Type|Determines whether the button will have standard behavior or if it will behave as a toggle button (i.e. the button toggles between an "on" and "off" state each time it's pressed).|
 |{{:wiki:play.png?nolink|}}|Button Action|Determines what action will be taken when the button is pressed (only applicable to the "Standard" button type). The available options are to run a [[script]], close the parent [[widget]], craft a new [[item]] into a [[item_storage_slot|storage slot]] using any populated [[crafting_input_slot|input slots]], or craft a specific [[item]] using the player's [[inventory]].| |{{:wiki:play.png?nolink|}}|Button Action|Determines what action will be taken when the button is pressed (only applicable to the "Standard" button type). The available options are to run a [[script]], close the parent [[widget]], craft a new [[item]] into a [[item_storage_slot|storage slot]] using any populated [[crafting_input_slot|input slots]], or craft a specific [[item]] using the player's [[inventory]].|
Line 15: Line 16:
 |{{:wiki:font.png?nolink|}}|Font|[[Font]] that will be used for the button's text. If the "Default" option is selected, your game's default dialogue [[font]] will be used.| |{{:wiki:font.png?nolink|}}|Font|[[Font]] that will be used for the button's text. If the "Default" option is selected, your game's default dialogue [[font]] will be used.|
 |{{:wiki:font_size.png?nolink|}}|Font Size|[[Font]] size to use for the button's text.| |{{:wiki:font_size.png?nolink|}}|Font Size|[[Font]] size to use for the button's text.|
 +
 +=====Scripting=====
 +You can access and change certain properties of a button from within a [[script]] by simply referencing the parent [[widget]] and the button element by their unique IDs. See below for examples of changing the text, [[image]], and [[script]] of a button. In these cases, the [[widget]] has an ID of "test" and the button has an ID of "0001".
 +
 +**Changing a button's text:**
 +<code bauxite>
 +widget["test"].element["0001"].text = "New Text";
 +</code>
 +
 +**Changing a button's image:**
 +<code bauxite>
 +widget["test"].element["0001"].image = "new_image.png";
 +</code>
 +
 +**Changing a button's script:**
 +<code bauxite>
 +widget["test"].element["0001"].script = "new_script_name";
 +</code>
  
 ~~NOTOC~~ ~~NOTOC~~
button.txt · Last modified: 2021/06/24 21:18 by justin