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.
| Operator | Symbol | Effect | Added in |
|---|---|---|---|
add | += | Add to the current value | 49 |
subtract | -= | Subtract from the current value | 49 |
multiply | *= | Multiply the current value | 49 |
divide | /= | Divide the current value | 49 |
set_to | = | Assign (replace) the current value | 49 |
modulo | %= | Replace with the remainder after division | 49 |
and | &= | Bitwise AND with the operand | 49 |
or | |= | Bitwise OR with the operand | 49 |
xor | ^= | Bitwise XOR with the operand | 73 |
not | ~= | Bitwise NOT merge (a not b → a &= ~b) | 73 |
abs | — | Set to the absolute value of the operand | 73 |
lshift | << | Bit-shift left and assign | 107 (MCC) |
rshift | >> | Bit-shift right and assign | 107 (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
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