Difference between revisions of "Set.view"
(Created page with "The '''set.view''' command assigns a view to a screen object. == Syntax == set.view(obj oA, byt VIEW); == Remarks == View Resource (AGI)|vie...") |
m (→Remarks) |
||
Line 7: | Line 7: | ||
== Remarks == | == Remarks == | ||
− | [[View Resource (AGI)| | + | [[View Resource (AGI)|View]] '''VIEW''' is assigned to [[screen object]] '''oA'''. The view must be loaded or AGI raises [[trappable error #3]]. |
− | When the view is assigned, AGI checks the current [[loop]] value of the screen object against the loop count of the newly assigned view. If the loop value exceeds the new loop count, the object's loop value is set to zero. This will only be a concern if a | + | When the view is assigned, AGI checks the current [[loop]] value of the screen object against the loop count of the newly assigned view. If the loop value exceeds the new loop count, the object's loop value is set to zero. This will only be a concern if a screen object gets assigned a view, the loop is changed to a non-zero value, and then a different view is assigned later. |
It is possible to assign the same view to multiple screen objects. King's Quest I does this with the alligators in the moat in the opening scene. | It is possible to assign the same view to multiple screen objects. King's Quest I does this with the alligators in the moat in the opening scene. |
Latest revision as of 21:21, 21 April 2019
The set.view command assigns a view to a screen object.
Syntax
Remarks
View VIEW is assigned to screen object oA. The view must be loaded or AGI raises trappable error #3.
When the view is assigned, AGI checks the current loop value of the screen object against the loop count of the newly assigned view. If the loop value exceeds the new loop count, the object's loop value is set to zero. This will only be a concern if a screen object gets assigned a view, the loop is changed to a non-zero value, and then a different view is assigned later.
It is possible to assign the same view to multiple screen objects. King's Quest I does this with the alligators in the moat in the opening scene.
Possible Errors
In version 2.089 only, AGI raises trappable error #2 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
<syntaxhighlight lang="agi"> animate.obj(o1); load.view(5); set.view(o1, 5); animate.obj(o2); set.view(o2, 5); [ ok to share a view </syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in all AGI versions. |
Byte-Code Value: | 41 (0x29 hex) |