Set.cel

From AGI Wiki
Revision as of 15:40, 20 April 2019 by Andrew Korson (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The set.cel command assigns a cel to a screen object.

Syntax

set.cel(obj oA, byt CEL);

Remarks

The current cel of screen object oA is set to CEL.

If a view has not been assigned to the screen object, AGI raises trappable error #10. If the value of CEL is not valid (exceeds last cel number available in the loop), AGI raises trappable error #8.

The number of the last cel in a loop can be determined using the last.cel command.

After the cel is assigned to the screen object, AGI validates that the cel will still fit on screen. If the new width or height would result in the object being over an edge, AGI automatically repositions it on the edge. Note that this is different from the shuffle function that AGI uses in other situations to validate screen position of screen objects.

In version 2.089 only, AGI raises trappable error #7 if object number oA is invalid. In all later versions, AGI does not check that object number oA is a valid screen object. If it is not, this command will overwrite other data on the memory heap, which may cause unexpected results, including possibly crashing AGI.

Possible Errors

Example

Code:

<syntaxhighlight lang="agi"> [ typical code to add a static view animate.obj(o1); load.view(8); set.view(o1, 8); set.loop(o1, 1); set.cel(o1, 2); position(o1, 20, 132); stop.cycling(o1); draw(o1); </syntaxhighlight>

Technical Information

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

See Also

last.cel
set.cel.v
set.loop
set.loop.v
set.view
set.view.v