Show.obj.v

From AGI Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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

Syntax

show.obj.v(var vVIEWNUM);

Remarks

The game is paused, and cel 0 of loop 0 of view B, where B is the value of vVIEWNUM, 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.v 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.v 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.

A common use of show.obj.v is to display the image of an item selected from the inventory item status screen.

Possible Errors

You should not use the show.obj.v 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:
selectedItem = 0; [ make sure nothing is pre-selected
set(inv_select_enabled);  [ enable selection
status();
if(selectedItem !=0 && selectedItem != 255)
  { [ if something was selected
  v90 = selectedItem;
  v90 += 200; [ item views are offset by 200
  show.obj.v(v90);
  }

Technical Information

Required Interpreter Version: Available in version 2.411 and above.
Byte-Code Value: 162 (0xA2 hex)

See Also

Inventory Item Commands
show.obj