User Tools

Site Tools


button

This is an old revision of the document!


Button


A button is a clickable widget element that can be configured to run a script, close the parent widget, craft a new item into a storage slot using any populated input slots, or craft a specific item using the player's inventory.

Element Properties

IconPropertyDescription
Button TypeDetermines 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).
Button ActionDetermines 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 storage slot using any populated input slots, or craft a specific item using the player's inventory.
ScriptScript that will be triggered when the button is clicked. This option is only available when the button type is “Toggle” or the button type is “Standard” with an action of “Run Script”. For toggle buttons, a local variable named $pressed will be available to your script. It will have a value of either true or false according to the new state of the button.
ItemItem that the game will attempt to craft using the player's inventory when the button is clicked. This option is only available when the button type is “Standard” with an action of “Craft Item by ID”.
ImageImage that will be displayed on the button. If an image is specified, it will appear to the left of the button's text.
TextText that will be displayed on the button.
Text AlignmentDetermines the horizontal alignment of the text. The available options are “Left”, “Center”, and “Right”.
FontFont that will be used for the button's text. If the “Default” option is selected, your game's default dialogue font will be used.
Font SizeFont size to use for the button's text.

Scripting

(WIP - Accessing/changing properties of the button via scripts)

widget["test"].element["0001"].text = "New Text"
widget["test"].element["0001"].image = "new_image.png"
widget["test"].element["0001"].script = "new_script_name"
button.1606798673.txt.gz · Last modified: 2020/11/30 20:57 by justin