Set.view

From AGI Wiki
Revision as of 21:16, 21 April 2019 by Andrew Korson (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The set.view command assigns a view to a screen object.

Syntax

set.view(obj oA, byt VIEW);

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 view 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

Code:

<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)

See Also

load.view
set.view.v