Get 1Click Maker

Change Variable ​

Change Variable
FREE 10 memory Flow & Logic

Set, add to or subtract from a user variable while the item runs.

Requires [add-on] - Conditions & Variables - 1Click inside the object that runs the action.

Change Variable updates a user variable at that point in the function. It is how state changes: a toggle flips, a counter grows, a mode is stored.

Fields ​

FieldRequiredWhat to enter
VariableYesThe user variable to change (dropdown).
ActionYesSet (=) replaces the value. Add (+) and Subtract (βˆ’) work on Integer and Float variables only.
ValueYesA literal value of the variable’s type, or another variable ($other, or a system variable such as !touched_key).

Examples ​

GoalVariableActionValue
Turn a state on$light (string)SetON
Count clicks$clicks (integer)Add1
Step back$page (integer)Subtract1
Remember who clicked$last_user (key)Set!touched_key
Copy a value$aSet$b

Type rules ​

The value must match the variable's type: text into strings, numbers into integers/floats, <x,y,z> into vectors, UUIDs into keys. Add/Subtract on a string does nothing.

Timing ​

A change is applied a few milliseconds after the action runs. If the very next action is a condition on the same variable, put a Timer of 0.1 seconds between them, otherwise the condition may still read the old value. In normal flows (change on one click, compare on the next) this never matters.

In a toggle, put the Change Variable first in each branch, before the actions people see. The actions of a function run one after the other and each takes a moment in Second Life; with the change at the end, a quick second click can still read the old value and run the same branch twice.

Where it runs ​

The variable lives in the object running the function. A HUD cannot change a variable inside a target directly; send a command and let the target's own function change its variable.