Observe.horizon

From AGI Wiki
Revision as of 06:56, 25 April 2019 by Andrew Korson (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The observe.horizon command prevents an object from going above the horizon.

Syntax

observe.horizon(obj oA);

Remarks

If screen object oA was previously set to ignore the horizon (using the ignore.horizon command), the observe.horizon command restores normal behavior.

Use the ignore.horizon command to allow an object to go past the horizon, all the way to the top of the screen.

Use the set.horizon command to adjust the location of the horizon.

Possible Errors

AGI does not check that screen 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"> set.horizon(42); [ adjust horizon ignore.horizon(o1); [ object 1 is now allowed above horizon ... observe.horizon(o1); [ object 1 is NOT allowed above horizon </syntaxhighlight>

Technical Information

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

See Also

ignore.horizon
set.horizon
observe.blocks
observe.objs