Show.obj

From AGI Wiki
Jump to: navigation, search

The show.obj command displays a view representing an inventory item and its description.

Syntax

show.obj(byt VIEWNUM);

Remarks

The game is paused, and cel 0 of loop 0 of view VIEWNUM is shown centered at the bottom of the screen. The view description is displayed above in a message box. Pressing any key erases the object and its definition, and play resumes.

Despite its name, the show.obj command is not associated with screen objects. In this context 'obj' refers to things a player may 'acquire' during a game, known as 'inventory items'. Note that the view number displayed is completely independent; it is not automatically linked in any way to inventory item numbers.

The show.obj command is most often used to display a close up image (cel 0 of loop 0) of inventory items that a player might pick up during the game. AGI displays the cel without any border, so if a border is desired it must be included in the cel's image. The cel is drawn with priority of 15. AGI will mask out transparent colors just like any other view, so the transparent color is usually set to a color that is not used by the cel.

Unlike most AGI commands involving view resources, the view does not need to be loaded first. AGI searches all currently loaded views, and if the view needed is not found, it will load it automatically. If an error occurs while loading the view, AGI will display a message of "Not now" and AGI will move to the next logic command without taking any further action. If there is insufficient memory to draw the cel on the screen, AGI will skip the image and just display the view description.

Note that the indirect version of this command (show.obj.v) was not available until version 2.411.

Possible Errors

You should not use the show.obj command on views that do not have a view description attached. AGI does not validate that a valid description exists, and if there is not one, AGI will use an invalid pointer and display meaningless characters.

If you attempt to show a view that does not exist, AGI will raise a runtime error and crash.

Example

Code:
if(said("examine", "key"))
  {
  show.obj(201);
  }

Technical Information

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

See Also

Inventory Item Commands
show.obj.v