User Tools

Site Tools


ru:widget
no way to compare when less than two revisions

Differences

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


ru:widget [2022/07/27 21:26] (current) – создано justcoop
Line 1: Line 1:
 +FIXME **Эта страница пока что не переведена полностью. Пожалуйста, помогите завершить перевод.**\\ //(Сотрите это сообщение по окончании перевода.)//
  
 +======Widget======
 +----
 +
 +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]].
 +
 +<WRAP center round info 100%>
 +Custom widgets can be displayed in-game using the [[Show Widget]] scripting function. You 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=====
 +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]], 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>
 +hide_widget("test");
 +$name = widget["test"].element["0001"].text;
 +display_message("Hello, " + $name + "!");
 +</code>
 +
 +This script will change the text of the [[button]] to "New Text".
 +<code bauxite>
 +widget["test"].element["0002"].text = "New Text";
 +</code>
 +
 +~~NOTOC~~
ru/widget.txt · Last modified: 2022/07/27 21:26 by justcoop