Difference between revisions of "Animate.obj"

From AGI Wiki
Jump to navigationJump to search
m (Collector moved page Animate.obj(); to Animate.obj over redirect)
Line 11: Line 11:
 
* if you specify an [[Animated Object|object]] that is outside the range specified in the [[OBJECT File]], the game will crash with a [[bad object number error]] (note: in the AGI Studio Template Game, the maximum number of objects is 16, meaning that <code>o0</code> through <code>o15</code> are valid; if you specify <code>o16</code>, then this error will occur)  
 
* if you specify an [[Animated Object|object]] that is outside the range specified in the [[OBJECT File]], the game will crash with a [[bad object number error]] (note: in the AGI Studio Template Game, the maximum number of objects is 16, meaning that <code>o0</code> through <code>o15</code> are valid; if you specify <code>o16</code>, then this error will occur)  
  
== Examples ==
+
== Example ==
 
 
The following example activates object 3 and assigned VIEW.035 to it:
 
 
 
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
 
<syntaxhighlight lang="agi">
 
<syntaxhighlight lang="agi">
animate.obj(o3);
+
// basic steps needed to create
load.view(35);
+
// and display a screen object
set.view(o3, 35);
 
</syntaxhighlight>
 
 
 
&nbsp;
 
<div class="CodeBlockHeader">Code:</div>
 
<syntaxhighlight lang="agi">
 
//basic steps needed to create
 
//and display a screen object
 
 
animate.obj(o2);
 
animate.obj(o2);
 
load.view(4);
 
load.view(4);
Line 33: Line 22:
 
draw(o2);
 
draw(o2);
 
</syntaxhighlight>
 
</syntaxhighlight>
 
&nbsp;
 
  
 
== Syntax ==
 
== Syntax ==

Revision as of 19:03, 21 March 2019

The animate.obj command tells the interpreter to activate the specified object. An object must be activated in the current room before it can be used.

animate.obj(object);

Parameters

  • object: an object, o0-o255; this object will be activated for use (note: the AGI Studio Template Game supports only o0-o15)

Possible errors

  • if you specify an object that is outside the range specified in the OBJECT File, the game will crash with a bad object number error (note: in the AGI Studio Template Game, the maximum number of objects is 16, meaning that o0 through o15 are valid; if you specify o16, then this error will occur)

Example

Code:
// basic steps needed to create
// and display a screen object
animate.obj(o2);
load.view(4);
set.view(o2,4);
position(o2,80,120);
draw(o2);

Syntax

animate.obj(obj oA);

Remarks

If the object number exceeds the max screen object count, AGI will generate an error.

Screen objects must be activated with the animate.obj command before it can be used in any other commands. Attempting to run commands on an uninitialized screen object will generate a runtime error.

If you call the animate.obj command on an object that is already activated, the command is ignored.

 

Technical Information

Required interpreter version Available in all AGI versions
Bytecode value 33 (0x21 hex)

See also

Sources

Some of the text in this article comes from the AGI Studio help file.