These scripts, defined in the file inventory.s are used to manipulate the player's inventory. Each inventory item has an item type and a unique inventory item code. This code can be used to refer to a particular item in the inventory.
Properties
Functions
property SelectedObject
This object will be used as the source object when the user clicks on the screen. The most common use is to represent the currently selected inventory object.
function CountItems
Returns the number of items in the inventory.
NotesThis script is defined in the standard file inventory.s.
function TakeItem (type)
Adds a new item to the inventory.
Parameters
type | | Type of item to add. |
ReturnsUnique inventory item code.
NotesThis script is defined in the standard file inventory.s.
ExampletakeItem(Walkto);
var thisKnife = takeItem(Knife);
function DropItem (type)
Drops an item from the inventory.
Parameters
type | | Item type or unique inventory code. |
NotesThis script is defined in the standard file inventory.s.
function DropAllItems
Drops all inventory items (in the current bank).
NotesThis script is defined in the standard file inventory.s.
function SelectItem (type)
Chooses which item is currently selected. The selected item is the one whose image is used by the cursor, and that is used to trigger all events involving the mouse.
Parameters
type | | Item type or unique inventory code of item to select. |
NotesThis script is defined in the standard file inventory.s.
ExampleselectItem(Walkto);
selectItem(targetItem);
function HaveItem (type)
Tests if an item is in the inventory by returning the count of all items of the specified type.
Parameters
ReturnsNumber of items.
NotesThis script is defined in the standard file inventory.s.
Exampleif haveItem(GoldKey) {
"You unlock the door with the gold key."
GoldDoorUnlocked = true;
}
if haveItem(LargeRock) > 3 {
"I'm too heavy to ride the raft."
"Unless I unload a few rocks first, I'll just sink."
}
function DeselectItem
Selects the cursor item, effectively "putting away" whichever item is currently selected, and sets the MouseSprite and MouseFrame to the DeafultMouseSprite and DefaultMouseFrame.
ReturnsReturns true if an item is deselected, or false if there was no item to deselect.
NotesThis script is defined in the standard file inventory.s.
|