Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: dace on Tue 23/12/2008 23:53:58

Title: recognizing intventory item description
Post by: dace on Tue 23/12/2008 23:53:58
I would like the Player to be able to throw any of his inventory items out the window.

I would like a display to read:  "You throw your [active inventory item] out the window."

Is there a convenient way to get a textual description of whatever the ActiveInventory happens to be without having to write "if" statements for each possible inventory item?

I tried using the GetTextProperty command as described in manual, to no avail.
I tried editing "Properties" for each item, but it does not appear to be item-specific.

I am very confused. Please help.
Title: Re: recognizing intventory item description
Post by: Dualnames on Wed 24/12/2008 00:17:30
Quote from: dace on Tue 23/12/2008 23:53:58
I would like the Player to be able to throw any of his inventory items out the window.

I would like a display to read:  "You throw your [active inventory item] out the window."

Is there a convenient way to get a textual description of whatever the ActiveInventory happens to be without having to write "if" statements for each possible inventory item?

I tried using the GetTextProperty command as described in manual, to no avail.
I tried editing "Properties" for each item, but it does not appear to be item-specific.

I am very confused. Please help.

Of course there is.
All you need is this:

Display("You throw your %s out the window.",player.ActiveInventory.Name);
Title: Re: recognizing intventory item description
Post by: dace on Wed 24/12/2008 01:50:19
so simple, yet so effective.

I thank you.
Title: Re: recognizing intventory item description
Post by: Dualnames on Wed 24/12/2008 02:30:01
Glaaad to be of serviceee
Title: Re: recognizing intventory item description
Post by: Trent R on Wed 24/12/2008 09:42:00
I believe that ActiveInventory is a pointer of a InventoryItem type. So you can use any of the InventoryItem functions on it.

~Trent
PS-The AGS Wiki has a good article (http://www.americangirlscouts.org/agswiki/AGS_Pointers_for_Dummies) on pointers.