Editing SetCounter

From Eternity Wiki
Jump to navigationJump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
'''SetCounter'''(''counter'', ''value'', ''operation'')
SetCounter (ctr, value, operation)


Sets a ''value'' to a ''counter'', possibly applying it a specific ''operation''.
*ctr: counter number, from 0 to 7.
 
*value: value to set, in the signed long integer range
===Arguments===
*operation:
*''counter'': counter number, from 0 to 7.
:'''assign''' or 0: ctr = value
*''value'': value to set, in the signed long integer range.
:'''add''' or 1: ctr += value
*''operation'': one of the following keywords or values:
:'''sub''' or 2: ctr -= value
:*'''assign''' (0): set ''counter'' to ''value''
:'''mul''' or 3: ctr *= value
:*'''add''' (1): increase ''counter'' by ''value''
:'''div''' or 4: ctr /= value
:*'''sub''' (2): decrease ''counter'' by ''value''
:'''mod''' or 5: ctr %= value
:*'''mul''' (3): multiply ''counter'' by ''value''
:'''and''' or 6: ctr &= value
:*'''div''' (4): divide ''counter'' by ''value''. Won't operate if ''value'' is 0.
:'''andnot''' or 7: ctr &= ~value
:*'''mod''' (5): calculate remainder of division of ''counter'' by ''value''. Won't operate if ''value'' is 0 or less.
:'''or''' or 8: ctr |= value
:*'''and''' (6): calculate bitwise AND of ''counter'' and ''value''. Useful to check if bits are set.
:'''xor''' or 9: ctr ^= value
:*'''andnot''' (7): calculate bitwise AND of ''counter'' and inverted ''value''. Useful to clear bits of a counter.
:'''rand''' or 10: ctr = rand()
:*'''or''' (8): calculate bitwise OR of ''counter'' and ''value''. Useful to set bits of a counter.
:'''randmod''' or 11: ctr = rand()%value
:*'''xor''' (9): calculate bitwise exclusive OR of ''counter'' and ''value''. Useful to toggle bits of a counter.
:'''rshift''' or 13: ctr >>= value
:*'''rand''' (10): ''counter'' becomes random number between 0 and 255.
:'''lshift''' or 14: ctr <<= value
:*'''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''


Sets a value to a variable for an actor, allowing dynamic behavior. Values can be merely assigned or operated on.


==See also==
==See also==
*[[CounterJump]]
*[[CounterJumpEx]]
*[[CounterOp]]
*[[CounterSwitch]]
*[[List of codepointers]]
*[[List of codepointers]]


[[Category:Codepointers]]
[[Category:Codepointers]]
Please note that all contributions to Eternity Wiki are considered to be released under the GNU Free Documentation License 1.2 (see Eternity Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)