From Wiki of ZZT
Jump to navigation Jump to search

Cycle can refer to an element's cycle parameter (which dictates how often a statted element updates), or the ZZT-OOP command #cycle n (which sets an object's cycle parameter to n). An element with a cycle parameter of n updates once every n ticks. The exception is for elements with a cycle of zero, which never update themselves.

For objects placed with the default editor, the default cycle value is 3. Thus, for games made with the default editor, it is common to see #cycle 1 as the first line of ZZT-OOP in order initialize the object. External editors can modify the cycle parameter, usually rendering that code unnecessary.

Note that elements with the same cycle number do not necessarily execute on the same tick. The element's index on the stat list is also a factor. The exact formula used to determine if a statted element executes on a given tick is (CurrentTick mod Cycle) = (CurrentStatTicked mod Cycle). Note that CurrentTick is reset to a value of 1 whenever it exceeds 420 (not a joke), so elements with a cycle value greater than 420 will never update.


#cycle <value>

The value needs to be positive - values smaller than 1 will be ignored.

Bugs and Quirks

  • Due to a division-by-zero error, cycle 0 transporters will crash the game when rendered.