Reposition.to.v

From AGI Wiki
Revision as of 19:28, 19 April 2019 by Andrew Korson (talk | contribs) (Created page with "The '''reposition.to.v''' command indirectly changes the position of a screen object that is currently drawn on the screen. == Syntax == reposition.to.v([[screen object|obj]...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The reposition.to.v command indirectly changes the position of a screen object that is currently drawn on the screen.

Syntax

reposition.to.v(obj oA, var vX, var vY);

Remarks

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

The reposition.to.v command erases the 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.v command.

The reposition.to.v command is functionally equivalent to calling the erase command followed by the position.v 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"))

 {
  v201 = 90;
  v202 = 78;
  reposition.to.v(wizard, v201, v202);
 }

</syntaxhighlight>

Technical Information

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

See Also

erase
position
position.v
reposition
reposition.to