Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: DoctorDan on Sun 01/06/2014 18:00:58

Title: Can't select inventory object in inventory screen
Post by: DoctorDan on Sun 01/06/2014 18:00:58
Just beginning here so this is a quite basic problem, but I have been unable to find an answer elsewhere in the forums or tutorials.

I am having trouble with an inventory item.

The item is picked up, added to and shows in the inventory as it should be but I am unable to select and drag it to use it from the GUI.

Is there something obvious I am doing wrong or need to check?


Title: Re: Can't select inventory object in inventory screen
Post by: Vincent on Sun 01/06/2014 18:26:27
you can try to search this section on the manual : GetAtScreenXY (inventory)

Returns the inventory item at SCREEN co-ordinates (X,Y).

Code (ags) Select

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);
}
Title: Re: Can't select inventory object in inventory screen
Post by: Khris on Sun 01/06/2014 18:26:59
I assume you have created a default game?

A common reason for this is a pretty huge inventory item sprite compared to the inventory window's relatively small ItemWidth and ItemHeight.
When you try and pick it up by clicking near the center of the sprite, you're outside the bounds of the active area and nothing happens.

Open gInventory in the GUIs node by double clicking it, click inside the white rectangle representing the InventoryWindow, then change its ItemWidth and ItemHeight properties according to the pixel dimensions of your inventory items.
This will also ensure that the items line up properly inside the window.
Title: Re: Can't select inventory object in inventory screen
Post by: DoctorDan on Sun 01/06/2014 19:11:56
Khris this seems to have solved the problem. Thanks so much for the assistance.