Difference between revisions of "Set.cel"

From AGI Wiki
Jump to navigationJump to search
(Created page with "set.cel   == <br />Syntax == <blockquote><code>set.cel(oA,B);</code></blockquote>   == Description == The current cel of object oA is set to B. If an invalid ce...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
set.cel
+
The '''set.cel''' command assigns a cel to a screen object.
  
&nbsp;
+
== Syntax ==
  
== <br />Syntax ==
+
set.cel([[screen object|obj]] oA, [[number|byt]] CEL);
  
<blockquote><code>set.cel(oA,B);</code></blockquote>
+
== Remarks ==
  
&nbsp;
+
The current [[cel]] of [[screen object]] '''oA''' is set to '''CEL'''.
== Description ==
 
  
The current cel of object oA is set to B. If an invalid cel number is given, the interpreter will generates an error (the number of the last cel in a loop can be determined using the last.cel command).
+
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]].
  
&nbsp;
+
The number of the last cel in a loop can be determined using the '''[[last.cel]]''' command.
== Sources ==
 
  
[[AGI Studio Help File]]
+
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.
  
&nbsp;
+
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]].
  
== See also ==
+
== Possible Errors ==
  
* <code>[[set.cel.v]]</code>
+
== Example ==
* <code>[[current.cel]]</code>
 
* <code>[[last.cel]]</code>
 
* <code>[[set.loop]]</code>
 
* <code>[[set.loop.v]]</code>
 
* <code>[[Cycling objects]]</code>
 
  
&nbsp;
+
<div class="CodeBlockHeader">Code:</div>
 +
<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>
  
[[Category:Object Commands]]
+
== Technical Information ==
[[Category:View Commands]]
+
 
 +
{| border="1" cellpadding="2"
 +
| style="background-color: #efefef" width="200" | '''Required Interpreter Version:'''
 +
| width="175" | Available in all AGI versions.
 +
|-
 +
| style="background-color: #efefef" | '''Byte-Code Value:'''
 +
| 47 (0x2F hex)
 +
|}
 +
 
 +
== See Also ==
 +
 
 +
'''[[last.cel]]'''<br />
 +
'''[[set.cel.v]]'''<br />
 +
'''[[set.loop]]'''<br />
 +
'''[[set.loop.v]]'''<br />
 +
'''[[set.view]]'''<br />
 +
'''[[set.view.v]]'''<br />
 +
[[Category:Commands]]<br />

Latest revision as of 15:40, 20 April 2019

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