Reposition.to

From AGI Wiki
Jump to navigationJump to search

The reposition.to command changes the position of a screen object currently drawn on the screen.

Syntax

reposition.to(obj oA, byt X, byt Y);

Remarks

The position of screen object oA is changed to (X, Y). The new location is validated using the shuffle function.

The reposition.to command erases the screen object from its old location before redrawing it in its new location.

This command can be executed on screen object that has been initialized but not yet drawn, in which case it functions exactly the same as the position command.

The reposition.to command is functionally equivalent to calling the erase command followed by the position command.

To change the position of a screen object relative to its current position, use the reposition command.

Possible Errors

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

  1. define wizard o2

... [ initialize and draw object if(said("teleport"))

 {
 reposition.to(wizard, 90, 78);
 }

</syntaxhighlight>

Technical Information

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

See Also

erase
position
position.v
reposition
reposition.to.v