Skip to content

Math operations

Operators for actions that modify a numeric value in place. Operand order is always <target> <operation> <value> (for example action set my_counter add 1).

Used by set, set_score, player_adjust_money, adjust_grenades, and the object_adjust_* health/shield actions.

Values match e_math_operation in @blamnetwork/blf. Reach scripts spell operators as words (add, set_to, multiply); the decompiler emits assignment-style symbols (+=, =, *=). Both forms are accepted.

OperatorSymbolEffectAdded in
add+=Add to the current value49
subtract-=Subtract from the current value49
multiply*=Multiply the current value49
divide/=Divide the current value49
set_to=Assign (replace) the current value49
modulo%=Replace with the remainder after division49
and&=Bitwise AND with the operand49
or|=Bitwise OR with the operand49
xor^=Bitwise XOR with the operand73
not~=Bitwise NOT merge (a not ba &= ~b)73
absSet to the absolute value of the operand73
lshift<<Bit-shift left and assign107 (MCC)
rshift>>Bit-shift right and assign107 (MCC)

Notes

Omaha Alpha (build 49) stores the operation in three bits, so only the first eight operators above are encodable. Omaha Delta (73) widens the field to four bits and adds XOR, NOT, and absolute assignment. Reach MCC (107 MCC) adds the bit-shift operators; on MCC builds abs is enum index 12 (it is index 10 on Xbox 360 TU1).

@blamnetwork/megalo accepts word names and symbols. Legacy blf enum names (multiply_by, set_to_absolute, …) are still accepted when parsing older scripts.

Example

megalo
action set my_counter set_to 0
action set my_counter add 1
action set temp modulo 5
action set_score add kill_points player killing_player
action object_adjust_shield current_player set_to 100