Set.cel.v

From AGI Wiki
Jump to navigationJump to search

The set.cel.v command assigns a cel to an object indirectly.

Syntax

set.cel.v(obj oA, var vCEL);

Remarks

The current cel of screen object oA is set to the value of variable vCEL.

If a view has not been assigned to the object, AGI raises trappable error #10. If the value of vCEL is not valid (exceeds maximum number of cels), 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 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.

Possible Errors

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.

Example

Code:
[ typical code to add a static view
animate.obj(o1);
load.view(8);
set.view(o1, 8);
set.loop(o1, 1);
v52 = 2;
set.cel(o1, v52);
position(o1, 20, 132);
stop.cycling(o1);
draw(o1);

Technical Information

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

See Also

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