CounterOp(operand1, operand2, destination, operation)
Sets the value of the destination counter to the operation between the operand1 and operand2 counters. The two operands and the destination can be identical.
- operand1, operand2: The counter IDs to operate on (from 0 to 7).
- destination: The target counter ID to receive the calculation between the two operands (from 0 to 7).
- operation: Can be one of the following keywords or numbers:
- add (1)
- sub (2)
- mul (3)
- div (4): division. Won't execute if operand2 = 0.
- mod (5): modulus. Return the remainder of the division. Won't execute if operand2 <= 0
- and (6): bitwise AND.
- or (8): bitwise OR.
- xor (9): bitwise exclusive OR.
- hitdice (12): calculate destination = operand1 * random(1, operand2)
- rshift (13): right shift. Divide operand1 by 2^operand2.
- lshift (14): left shift. Multiply operand1 by 2^operand2.
The following operators are all unary and operand2 will be ignored:
- abs (15): absolute value.
- negate (16): negative value.
- not (17): logical NOT. Return 1 if operand1 is 0, return 0 otherwise.
- invert (18): one's complement (bitwise NOT).