Difference between revisions of "Animate.obj"

From AGI Wiki
Jump to navigationJump to search
Line 1: Line 1:
 
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.
 
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.
  
<code>animate.obj(object);</code>
+
== Syntax ==
 +
 
 +
: animate.obj([[Screen objects|obj]] oA);
  
 
== Parameters ==
 
== Parameters ==
  
* <code>object</code>: an object, <code>o0-o255;</code> this object will be activated for use ('''note:''' the [[AGI Studio Template Game]] supports only <code>o0-o15</code>)
+
* oA: the [[screen object]] that will be activated for use  
 +
 
 +
== Remarks ==
 +
 
 +
Screen objects must be initialized with the '''animate.obj''' command before they can be used in any other commands. Most commands that are run on an uninitialized screen objects are just ignored by AGI, but some of them can result in interactions with invalid data.
 +
When a [[screen object]] is initialized it is enabled for [[updating]] and [[cycling]] by default.
 +
If you call the '''animate.obj''' command on an object that is already initialized, the command is ignored.
  
 
== Possible errors ==
 
== Possible errors ==
  
* 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 the object number exceeds the [[Screen objects#Maximum screen objects|max screen object]] value (specified in the [[OBJECT File]]), AGI will raise [[trappable error]] #13.
  
 
== Example ==
 
== Example ==
 +
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
 
<syntaxhighlight lang="agi">
 
<syntaxhighlight lang="agi">
Line 23: Line 32:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Syntax ==
 
 
: animate.obj([[Screen objects|obj]] oA);
 
 
== Remarks ==
 
 
If the object number exceeds the [[Screen objects#Maximum screen objects|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.
 
 
&nbsp;
 
 
== Technical Information ==
 
== Technical Information ==
  
 
{| border="1" cellpadding="2"
 
{| border="1" cellpadding="2"
| style="background-color: #efefef" | '''Required interpreter version'''
+
| style="background-color: #efefef" width="200" | '''Required Interpreter Version:'''
| Available in all AGI versions
+
| width="175" |Available in all AGI versions
 
|-
 
|-
| style="background-color: #efefef" | '''Bytecode value'''
+
| style="background-color: #efefef" | '''Byte-Code Value:'''
 
| 33 (0x21 hex)
 
| 33 (0x21 hex)
 
|}
 
|}

Revision as of 19:57, 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.

Syntax

animate.obj(obj oA);

Parameters

Remarks

Screen objects must be initialized with the animate.obj command before they can be used in any other commands. Most commands that are run on an uninitialized screen objects are just ignored by AGI, but some of them can result in interactions with invalid data. When a screen object is initialized it is enabled for updating and cycling by default. If you call the animate.obj command on an object that is already initialized, the command is ignored.

Possible errors

If the object number exceeds the max screen object value (specified in the OBJECT File), AGI will raise trappable error #13.

Example

Code:

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

Technical Information

Required Interpreter Version: Available in all AGI versions
Byte-Code Value: 33 (0x21 hex)

See also

Sources

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