recognizing intventory item description

Started by dace, Tue 23/12/2008 23:53:58

Previous topic - Next topic

dace

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.

Dualnames

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);
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

dace

so simple, yet so effective.

I thank you.

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Trent R

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 on pointers.
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

SMF spam blocked by CleanTalk