Cycle.time

From AGI Wiki
Jump to navigationJump to search

The cycle.time command sets the delay time between changes in an object's cel.

Syntax

cycle.time(obj oA, var vB);

Remarks

The cycle time of object oA is set to the value of vB.

The cycle time property determines the number of interpreter cycles that occur between each change in an object's cel. For example, if cycle time is 1, then a cel change occurs on every cycle; if cycle time is 2, a cel change occurs on every other cycle, and so on.

Setting cycle time to zero will freeze the object's current cel; no further cel changes will occur while cycle time is zero. (This has the same effect as using the stop.cycling command.)

Don't confuse cycle time with step time. Step time determines how often an object takes a step (moves), and can be set independent of cycle time.

Possible Errors

AGI does not check that object number oA is a valid object. If it is not, this command will overwrite other data on the memory heap, which may cause unexpected results, including possibly crashing AGI.

Example

Code:

<syntaxhighlight lang="agi"> cycle.time(o1, 4); [ object o1 changes its cel every fourth cycle

                  [ this could be used to make something appear in slow motion

</syntaxhighlight>

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 76 (0x4C hex)

See Also

step.time