SetCounter: Difference between revisions
From Eternity Wiki
Jump to navigationJump to search
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
SetCounter ( | '''SetCounter'''(''counter'', ''value'', ''operation'') | ||
* | Sets a ''value'' to a ''counter'', possibly applying it a specific ''operation''. | ||
*value: value to set, in the signed long integer range | |||
*operation: | ===Arguments=== | ||
:'''assign''' | *''counter'': counter number, from 0 to 7. | ||
:'''add''' | *''value'': value to set, in the signed long integer range. | ||
:'''sub''' | *''operation'': one of the following keywords or values: | ||
:'''mul''' | :*'''assign''' (0): set ''counter'' to ''value'' | ||
:'''div''' | :*'''add''' (1): increase ''counter'' by ''value'' | ||
:'''mod''' | :*'''sub''' (2): decrease ''counter'' by ''value'' | ||
:'''and''' | :*'''mul''' (3): multiply ''counter'' by ''value'' | ||
:'''andnot''' | :*'''div''' (4): divide ''counter'' by ''value''. Won't operate if ''value'' is 0. | ||
:'''or''' | :*'''mod''' (5): calculate remainder of division of ''counter'' by ''value''. Won't operate if ''value'' is 0 or less. | ||
:'''xor''' | :*'''and''' (6): calculate bitwise AND of ''counter'' and ''value''. Useful to check if bits are set. | ||
:'''rand''' | :*'''andnot''' (7): calculate bitwise AND of ''counter'' and inverted ''value''. Useful to clear bits of a counter. | ||
:'''randmod''' | :*'''or''' (8): calculate bitwise OR of ''counter'' and ''value''. Useful to set bits of a counter. | ||
:'''rshift''' | :*'''xor''' (9): calculate bitwise exclusive OR of ''counter'' and ''value''. Useful to toggle bits of a counter. | ||
:'''lshift''' | :*'''rand''' (10): ''counter'' becomes random number between 0 and 255. | ||
:*'''randmod''' (11): ''counter'' becomes random number between 0 and ''value'' - 1. Won't operate if ''value'' is 0 or less. | |||
:*'''rshift''' (13): divide ''counter'' by 2^''value'' | |||
:*'''lshift''' (14): multiply ''counter'' by 2^''value'' | |||
==See also== | ==See also== | ||
*[[CounterJump]] | *[[CounterJump]] | ||
*[[CounterJumpEx]] | |||
*[[CounterOp]] | |||
*[[CounterSwitch]] | |||
*[[List of codepointers]] | *[[List of codepointers]] | ||
[[Category:Codepointers]] | [[Category:Codepointers]] |
Latest revision as of 07:31, 1 April 2023
SetCounter(counter, value, operation)
Sets a value to a counter, possibly applying it a specific operation.
Arguments[edit]
- counter: counter number, from 0 to 7.
- value: value to set, in the signed long integer range.
- operation: one of the following keywords or values:
- assign (0): set counter to value
- add (1): increase counter by value
- sub (2): decrease counter by value
- mul (3): multiply counter by value
- div (4): divide counter by value. Won't operate if value is 0.
- mod (5): calculate remainder of division of counter by value. Won't operate if value is 0 or less.
- and (6): calculate bitwise AND of counter and value. Useful to check if bits are set.
- andnot (7): calculate bitwise AND of counter and inverted value. Useful to clear bits of a counter.
- or (8): calculate bitwise OR of counter and value. Useful to set bits of a counter.
- xor (9): calculate bitwise exclusive OR of counter and value. Useful to toggle bits of a counter.
- rand (10): counter becomes random number between 0 and 255.
- randmod (11): counter becomes random number between 0 and value - 1. Won't operate if value is 0 or less.
- rshift (13): divide counter by 2^value
- lshift (14): multiply counter by 2^value