Difference between revisions of "Set.cel.v"

From AGI Wiki
Jump to navigationJump to search
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
set.cel.v
+
The '''set.cel.v''' command assigns a cel to an object indirectly.
  
 
+
== Syntax ==
  
== <br />Syntax ==
+
set.cel.v([[screen object|obj]] oA, [[variable|var]] vCEL);
  
<blockquote><code>set.cel.v(oA,vB);</code></blockquote>
+
== Remarks ==
  
== <br />Description ==
+
The current [[cel]] of [[screen object]] '''oA''' is set to the value of [[variable]] '''vCEL'''.
  
The current cel of object oA is set to vB. 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 Resource (AGI)|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]].
  
&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 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;
+
== Possible Errors ==
  
== See also ==
+
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]].
  
* <code>[[set.cel]]</code>
+
== Example ==
* <code>[[current.cel]]</code>
 
* <code>[[last.cel.v]]</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);
 +
v52 = 2;
 +
set.cel(o1, v52);
 +
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:'''
 +
| 48 (0x30 hex)
 +
|}
 +
 
 +
== See Also ==
 +
 
 +
'''[[last.cel]]'''<br />
 +
'''[[set.cel]]'''<br />
 +
'''[[set.loop]]'''<br />
 +
'''[[set.loop.v]]'''<br />
 +
'''[[set.view]]'''<br />
 +
'''[[set.view.v]]'''<br />
 +
[[Category:Commands]]<br />

Latest revision as of 16:16, 20 April 2019

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:

<syntaxhighlight lang="agi"> [ 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); </syntaxhighlight>

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