Buttons To Directly Alter The Inventory (SOLVED)

Started by FrancoFranchi, Tue 17/04/2007 23:12:31

Previous topic - Next topic

FrancoFranchi

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

Ashen

Check out the manual:
InvWindow.TopItem and InvWindow.GetItemAtIndex (to get the item currently displayed), and InventoryItem.RunInteraction (to ... well, I guess that's pretty self explanatory). E.g.:
Code: ags

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


(Or you may need to make a Pointer to the Item, before you can use RunInteraction.)
I know what you're thinking ... Don't think that.

FrancoFranchi

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 :)

SMF spam blocked by CleanTalk