(Formerly known as global function GetInvAt, which is now obsolete)
static InventoryItem* InventoryItem.GetAtScreenXY(int x, int y)
Returns the inventory item at SCREEN co-ordinates (X,Y). Note that this
only detects inventory items on custom Inventory windows (that are switched on when
this function is called), and is intended to allow you to do Verb Coin style GUIs and so on.
If there is no inventory item there, or if invalid co-ordinates are specified,
returns null.
NOTE: The co-ordinates are SCREEN co-ordinates, NOT ROOM co-ordinates. This
means that with a scrolling room, the co-ordinates you pass are relative to
the screen's current position, and NOT absolute room co-ordinates. This
means that this function is suitable for use with the mouse cursor position
variables.
Example:
InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
if (item == null) {
Display("No inventory item at the mouse co-ordinates");
}
else {
Display("Inventory item number %d at the mouse.", item.ID);
}
will display the number of the inv item that the mouse is over
See Also: InventoryItem.Name,
Game.GetLocationName
|