Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Ashen on Wed 04/05/2005 15:02:43

Title: Inventory index in 2.62
Post by: Ashen on Wed 04/05/2005 15:02:43
(Not a great title, but I couldn't think of anything more descriptive.)

Is it possible to find the inventory slot of an item (as used by game.top_inv_item)? Something like InvWindow.ItemAtIndex[] in 2.7, but the other way round (i.e. returns the index rather than the item number, or -1 if you don't have that item) - and that works in 2.62, obviously.

EDIT: Or, is there some sort of inventoryindex[] array, like savegameindex[] , that I could use?

I've got a workaround for now, but it's a lot of scripting for something that might be an existing but undocumented feature. (Unless it is documented, and I'm just an idiot, in which case, roll on the RTFM's).
Title: Re: Inventory index in 2.62
Post by: Pumaman on Wed 04/05/2005 18:19:31
No, I don't believe there is. 2.62 has very limited scriptability of inventory windows, and I don't think there's a way you can access this information.

Just to clarify: you're after some sort of  GetIndexOfItem(int inventoryItem)   right?
Title: Re: Inventory index in 2.62
Post by: Ashen on Wed 04/05/2005 18:35:18
Yeah, that's it.

Thinking about it, if there was a 2.62 equivalent of GetItemAtIndex[], I could probably work backwards from that. Even, as I edited before, an inventoryindex array would be handy to know about - presumably there's something like it built-in,  since game.top_inv_item seems to use it.

It's not a big thing if it's not there - like I said I've got a way work around it, I just wondered if there was a way to trim the script down a bit.
Title: Re: Inventory index in 2.62
Post by: Pumaman on Wed 04/05/2005 18:41:35
Well, the AGS engine has that information obviously, since it draws the inventory window.

But in 2.62, it is not accessible to the script.