Erase

From AGI Wiki
Jump to navigationJump to search

The erase command removes a screen object from the visual screen.

Syntax

erase(obj oA);

Remarks

Erasing a screen object only removes it from the visual screen. It retains its position, direction and motion and cycling styles, and will continue where it left off if later redrawn.

While invisible, the object can be manipulated by repositioning, changing motion and cycling styles, changing views, loops, cels, etc.

Use the draw command to draw the object on the visual screen.

If you use the erase command on an object that has not been drawn, the command is ignored.

Possible Errors

When the erase command is executed, AGI first checks that the object's number is less than or equal to the max screen object number; if not, AGI will raise trappable error #12.

Example

Code:

<syntaxhighlight lang="agi">

  1. define kirk o2
  2. define transporterview 90

... [ initialize object draw(kirk); ... print("Kirk says, \"Beam me up, Scotty!\""); load.view(transporterview); set.view(kirk, transporterview); end.of.loop(kirk, f99); if(isset(f99))

 {
 erase(kirk);
 reset(f99);
 }

</syntaxhighlight>

Technical Information

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

See Also

draw