Skip to content

Chasing and modifying variables

ItsDeltin edited this page Mar 31, 2020 · 1 revision

Chasing and Modifying Variables

Modify Variables

The workshop actions Modify Global Variable, Modify Player Variable, Modify Global Variable At Index, and Modify Player Variable At Index can be used in OSTW using the single function, ModifyVariable. It works with every variable type including global, player, scoped, and class variables.

ModifyVariable(createdEffects, Operation.AppendToArray, LastCreatedEntity());

You can modify at an index by adding an indexer after the declared variable.

ModifyVariable(lowestNodes[x], Operation.Min, Node.Flags);

Player variables can be modified by preceeding the variable with an expression that resolved to a player. If no player is provided when modifying a player variable, Event Player will be used by default.

ModifyVariable(target.Links, Operation.AppendToArray, host.Links[i]);

Operations

  • Add*
  • Subtract*
  • Multiply*
  • Divide*
  • Modulo*
  • RaiseToPower*
  • Min
  • Max
  • AppendToArray
  • RemoveFromArrayByValue
  • RemoveFromArrayByIndex

* These operations can be executed using the respective operators +=, -=, *=, /=, %=, and ^=.

Chasing Variables

ChaseVariableAtRate and ChaseVariableOverTime handle the variable the same as ModifyVariable except they do not support indexes or non-static class variables.

Clone this wiki locally