Item

Methods
6
Fields
None

Getting one

Item.new(…)
client:getItemContainer(…):getItem(…)

Methods

MethodReturnsDescription
getId()numberThe item id, -1 for an empty slot.
getQuantity()numberThe quantity.
getSlot()numberThe slot it was read from (ItemContainer:getItems(), getItem), -1 for an item not read from a slot.
interact(string)booleanChoose option ("Eat", "Wield", "Drop", ...) on the item where it was read from, through the virtual mouse. It acts on an item `client:get…
equals(any)booleanWhether other equals this Item, as == answers it (false for a value of another class).
new(number, number)ItemAn item of id and quantity.

Returned by

MethodReturnsDescription
ItemClass.newItemAn item of id and quantity.
ItemContainer.getItemItem?The item in slot, or nil for an empty slot or one past the end.
ItemContainer.getItems{Item}Every slot's item, empty slots as id -1 quantity 0.

Method details

getId

getId: (Item) -> number

The item id, -1 for an empty slot.

getSlot

getSlot: (Item) -> number

The slot it was read from (ItemContainer:getItems(), getItem), -1 for an item not read from a slot.

interact

interact: (Item, string) -> boolean

Choose option ("Eat", "Wield", "Drop", ...) on the item where it was read from, through the virtual mouse. It acts on an item client:getItemContainer(InventoryID.INV) or .WORN handed out (getItems(), getItem(slot)): the op is resolved from the item's definition and the scheduler moves the virtual mouse onto its slot and clicks. false when the item came from another container, its slot no longer holds it, or it has no such option. Raises for an item not read from a slot (Item.new).

equals

equals: (Item, any) -> boolean

Whether other equals this Item, as == answers it (false for a value of another class).

new

new: (number, number) -> Item

An item of id and quantity.