AddInventory (int what)Adds inventory index WHAT to the current player character's inventory. This has the same effect as doing character[EGO].inv[WHAT]+=1; however, it will add the inventory to the current player character and also update the inventory window.
Example:
AddInventory(10);will give to the player character the inventory item numbered 10. See Also: LoseInventory
GetInvName (int item, string buffer)Fills in BUFFER with the name of inventory item index ITEM. This is the name which the item is given under the Game tab, Inventory mode of the Room Editor.
Example:
string buffer; GetInvName (player.activeinv, buffer);will pass the inventory item’s name to the buffer.
See Also: GetLocationName
InventoryScreen ()Brings up the Sierra-style inventory window which allows the player to select and manipulate inventory items. If they select one, the cursor mode will be set to inventory-use (mode 4), and character[EGO].activeinv will be set to the inventory item selected.
NOTE: This function does not actually bring up the window immediately; instead, it will show the window when the current script function finishes executing.
NOTE: If the player has no inventory items, global message 996 will be displayed.
LoseInventory (int what)Removes inventory item WHAT from the current player character's inventory. If they do not have the item, nothing happens.
Example:
LoseInventory(10);will make the player character lose the inventory item numbered 10 in the inventory tab
See Also: AddInventory
RunInventoryInteraction (int item, int mode)Processes the interaction list as if the player had clicked the mouse on inventory item ITEM in cursor mode MODE. MODE is one of the MODE_* constants listed in the ProcessClick description.
Example:
if (button == LEFTINV) RunInventoryInteraction(game.inv_activated, GetCursorMode());will run the inventory interaction for the current cursor mode when the player clicks on the item (Handle Inv Clicks needs to be enabled for this to work)
See Also: ProcessClick, RunCharacterInteraction
SetActiveInventory (int inv_item)Sets the current active inventory item for the current player character to INV_ITEM. This function changes the player.activeinv variable, and also sets up the mouse cursor as necessary. To deselect the current inventory, pass INV_ITEM as -1.
Example:
SetActiveInventory(10);will make the inventory item 10 active (before you use it make sure that the player has the inventory item )
SetInvDimensions (int width, int height)Allows you to change the default width and height of the inventory item picture slots used by the Lucasarts-style inventory window. By default, the LEC inv window is made up of 40x22 pixel cells, but if all your inventory item pictures are bigger or smaller than this, you can use this function to adjust them.
Example:
SetInvDimensions(60,30);if your inventory graphics are 60x30 pixels or smaller.
SetInvItemPic (int inv, int sprite_slot)Changes inventory item INV's graphic to be slot number SPRITE_SLOT from the Sprite Manager. This allows you to dynamically adjust an item's picture in the inventory window during the game.
Example:
SetInvItemPic(10,120);will change the number 10 inventory item’s graphic, to the picture imported in slot 120 (sprite manager’s slot).
UpdateInventory ()Updates the player's inventory display. If you add or remove inventory items manually (ie. by using the character[].inv[] variables rather than the AddInventory/LoseInventory functions), the display may not get updated. In this case, after making your changes, call this function to update what is displayed to the player.
See Also: AddInventory, LoseInventory