Difference between revisions of "Cycle.time"

From AGI Wiki
Jump to navigationJump to search
(Created page with "cycle.time   == <br />Syntax == <blockquote><code>cycle.time(oA,vB);</code></blockquote> == <br />Description == he delay (in interpreter cycles) between cel changes...")
 
 
Line 1: Line 1:
cycle.time
+
The '''cycle.time''' command sets the delay time between changes in an object's cel.
  
&nbsp;
+
== Syntax ==
  
== <br />Syntax ==
+
cycle.time([[screen object|obj]] oA, [[variable|var]] vB);
  
<blockquote><code>cycle.time(oA,vB);</code></blockquote>
+
== Remarks ==
  
== <br />Description ==
+
The cycle time of object '''oA''' is set to the value of '''vB'''.
  
he delay (in interpreter cycles) between cel changes of object oA (when it is cycling) is set to vB. If vB is equal to 0, the cels do not change (even when the object is cycling). Note that an object’s cycle time is separate to it’s <code>[[step.time]]</code>.
+
The [[cycle time]] property determines the number of [[interpreter cycles]] that occur between each change in an object's [[cel]]. For example, if cycle time is 1, then a cel change occurs on every cycle; if cycle time is 2, a cel change occurs on every other cycle, and so on.
  
== <br />Sources ==
+
Setting cycle time to zero will freeze the object's current cel; no further cel changes will occur while cycle time is zero. (This has the same effect as using the '''[[stop.cycling]]''' command.)
  
[[AGI Studio Help File]]
+
Don't confuse cycle time with [[step time]]. Step time determines how often an object takes a step (moves), and can be set independent of cycle time.
  
== <br />See also ==
+
== Possible Errors ==
  
* <code>[[step.time]]</code>
+
AGI does not check that object number oA is a valid object. If it is not, this command will overwrite other data on the [[memory heap]], which may cause unexpected results, including possibly [[crashing AGI]].
* [[Cycling Objects]]
 
  
&nbsp;
+
== Example ==
  
[[Category:Object Commands]]
+
<div class="CodeBlockHeader">Code:</div>
[[Category:View Commands]]
+
<syntaxhighlight lang="agi">
[[Category:References]]
+
cycle.time(o1, 4); [ object o1 changes its cel every fourth cycle
[[Category:Logic]]
+
                  [ this could be used to make something appear in slow motion
 +
</syntaxhighlight>
 +
 
 +
== Technical Information ==
 +
 
 +
{| 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:'''
 +
| 76 (0x4C hex)
 +
|}
 +
 
 +
== See Also ==
 +
 
 +
'''[[step.time]]'''<br />
 +
[[Category:Commands]]<br />

Latest revision as of 19:32, 29 March 2019

The cycle.time command sets the delay time between changes in an object's cel.

Syntax

cycle.time(obj oA, var vB);

Remarks

The cycle time of object oA is set to the value of vB.

The cycle time property determines the number of interpreter cycles that occur between each change in an object's cel. For example, if cycle time is 1, then a cel change occurs on every cycle; if cycle time is 2, a cel change occurs on every other cycle, and so on.

Setting cycle time to zero will freeze the object's current cel; no further cel changes will occur while cycle time is zero. (This has the same effect as using the stop.cycling command.)

Don't confuse cycle time with step time. Step time determines how often an object takes a step (moves), and can be set independent of cycle time.

Possible Errors

AGI does not check that object number oA is a valid 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"> cycle.time(o1, 4); [ object o1 changes its cel every fourth cycle

                  [ this could be used to make something appear in slow motion

</syntaxhighlight>

Technical Information

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

See Also

step.time