Normal.cycle

From AGI Wiki
Revision as of 18:33, 12 April 2019 by Andrew Korson (talk | contribs) (→‎Possible Errors)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The normal.cycle command switches an object's cycle mode to 'normal'.

Syntax

normal.cycle(obj oA);

Remarks

In 'normal' cycle mode, screen object oA will cycle through the cels in the current loop from first to last. The cycle repeats indefinitely.

Setting the cycle mode to 'normal' will NOT automatically enable the object for updating if it is not currently enabled. You must use the start.update command to enable updating. The cycling property is enabled.

Changing cycle mode does not change the current cel. The new cycle mode begins with whatever cel is currently assigned to the object.

Use the stop.cycling command to turn cycling off. The end.of.loop, reverse.cycle and reverse.loop commands can be used to switch to other cycle modes.

Possible Errors

AGI does not check that oA is a valid screen object. If the screen object has not been initialized, the normal.cycle command still sets the cycle mode to normal; nothing will happen though. If the object number exceeds the max screen object number, data used for other purposes will be overwritten, which may result in unexpected results, including possibly crashing AGI.

Example

Code:

<syntaxhighlight lang="agi">

  1. define elevator o5

[ initialize the object, and draw it on screen ... normal.cycle(elevator); [ going up... ... reverse.cycle(elevator); [ going down... </syntaxhighlight>

Technical Information

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

See Also

end.of.loop
reverse.cycle
reverse.loop
stop.cycling
Cycling Objects