Skip to content

Change Switch

Change Switch

Alters the value of a Switch, with support for ranges and Local or Global switches.

Targets

Name Explanation
Global / Local Targets a single Variable.
Global / Local Range Targets multiple contiguous Variables.
Global / Local Reference Targets a single Variable based on a Variable index.

Values

Name Explanation
Value Leverages a value, as a Number or String.
Local Leverages a single Local Variable.
Global Leverages a single Global Variables.
Random Leverages a random Number value, between a Minimum and Maximum.

Examples

Set Global Switch 0 to Random

This sets Global Switch 0 to a random value.

$gs[0] = random();
{"Data":{"Random":1,"Value":0,"Index":0,"IndexEnd":null,"IsLocal":0,"IsOperandReference":0,"IsReference":0,"OperandGlobalIndex":null,"OperandLocalIndex":null,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Data.SwitchCommand"}

Set Global Switches 0 through 99 to Off

This sets Global Switches 0 through 99 to Off.

$gs[0:99] = false;
{"Data":{"Random":0,"Value":0,"Index":0,"IndexEnd":99,"IsLocal":0,"IsOperandReference":0,"IsReference":0,"OperandGlobalIndex":null,"OperandLocalIndex":null,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Data.SwitchCommand"}

Set Global Switch by Reference, Based on Global Variable 3

This sets a Global Switch, with an index specified by Global Variable 3, to On.

$ref_gs[3] = true;
{"Data":{"Random":0,"Value":1,"Index":3,"IndexEnd":null,"IsLocal":0,"IsOperandReference":0,"IsReference":1,"OperandGlobalIndex":null,"OperandLocalIndex":null,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Data.SwitchCommand"}

Set Local Switch 3 to Global Switch 0

This sets Local Switch 3 to the value in Global Switch 0.

$ls[3] = $gs[0];
{"Data":{"Random":0,"Value":0,"Index":3,"IndexEnd":null,"IsLocal":1,"IsOperandReference":0,"IsReference":0,"OperandGlobalIndex":0,"OperandLocalIndex":null,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Data.SwitchCommand"}