Set.view.v
The set.view.v command assigns a view to an object indirectly.
Syntax
set.view.v(obj oA, var vVIEW);
Remarks
View B (where B is the value of variable vVIEW) 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); v51 = 5; load.view.v(v51); set.view.v(o1, v51); animate.obj(o2); set.view.v(o2, v51); [ ok to share a view </syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in all AGI versions. |
Byte-Code Value: | 42 (0x2A hex) |