Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: FrancoFranchi on Tue 17/04/2007 23:12:31

Title: Buttons To Directly Alter The Inventory (SOLVED)
Post by: FrancoFranchi on Tue 17/04/2007 23:12:31
Buttons To Directly Alter The Inventory

Hi, I've tried searching through a few topics with 'buttons' and 'inventory' but haven't found anything I'm looking for but I can't figure it out (though that could just be my stupidity talking).

Basically, I've put together an inventory GUI which serves as my main character's email program, with each email sitting on a single screen that can be scrolled up or down by the use of scroll buttons.  At the moment, the only way I've figured out how to interact with these items is by placing buttons which change the cursor to different user modes to look or interact with them,  However, this forces the player to click once on the cursor button and then on the item they want to interact with.  Is there any way to program the script so that a single button press would automatically apply the function on the inventory item currently being displayed in the scrollbox?

Thanks
Title: Re: Buttons To Directly Alter The Inventory
Post by: Ashen on Tue 17/04/2007 23:38:20
Check out the manual:
InvWindow.TopItem (http://www.adventuregamestudio.co.uk/manual/InvWindow.TopItem.htm) and InvWindow.GetItemAtIndex (http://www.adventuregamestudio.co.uk/manual/InvWindow.ItemAtIndex.htm) (to get the item currently displayed), and InventoryItem.RunInteraction (http://www.adventuregamestudio.co.uk/manual/InventoryItem.RunInteraction.htm) (to ... well, I guess that's pretty self explanatory). E.g.:

invMain.GetItemAtIndex[invMain.TopItem].RunInteraction(eModeLook);


(Or you may need to make a Pointer to the Item, before you can use RunInteraction.)
Title: Re: Buttons To Directly Alter The Inventory
Post by: FrancoFranchi on Tue 17/04/2007 23:45:57
Thanks for the tips - I was wondering about the ItemAtIndex command but I assumed this would simply work to highlight a specific inventory item based on its relation to the number of objects in the inventory instead of targetting only the one currently on screen (with 'TopItem' referring to the first in the inventory, not necessarily the only item that would be visible at that time).  Not entirely sure I understand yet but I will fiddle around with those commands to see what works :)