<assign name="" expr=""/>

Assigns a value to a specified variable.

The expression (expr="") can contain constants (within single quotes) or other variables (without quotes). It can also contain the addition (+), subtraction (-), multiplication (*) or division (/) operators.

Variables do not have to be explicitly declared. They are automatically declared when used.

Child of: <button>, <click>, <image>, <media>*, <media_overlay>, <mouse_click>, <mouse_down>, <mouse_move>, <mouse_out>, <mouse_over>, <node name="">, <press>, <release>, <settings>
Parent of: Nothing

* Note that an assign within a <button>, <image>, <media> or <media_overlay> tag will only be executed if the user clicks the button, image or media.

Examples:

<assign name="a" expr="'yes'"/>
after: a = yes

<assign name="a" expr="'1'+'2'"/>
after: a = 3

before: a = 3
<assign name="b" expr="'5'-a"/>
after: b = 2

before: a = 3
<assign name="b" expr="'1'+'a'"/>
after: b = 1a

before: a = 2
<assign name="b" expr="a*'7'"/>
after: b = 14

before: a = 12
<assign name="b" expr="a/'3'"/>
after: b = 4

Working example: Search for <assign name="" expr=""/> in the file trivia_demo.xml.