Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Harvester on Thu 11/09/2003 00:32:57

Title: Using inventory item on another inventory item
Post by: Harvester on Thu 11/09/2003 00:32:57
I have a scripting problem (wow, unbelieveable!), either because of a bug in the engine or because of my stupidity, probably the latter.
Anyway, let's say that my character has two inventory items, numbered 1 and 2. When player uses inventory item 1 on inventory item 2, a message should appear.
I used the following code for inventory item 2 (when inventory item is used on it):

if (character[GetPlayerCharacter()].activeinv == 1)
{
Display("Testing.");
}

Of course, this doesn't work. But when I select the action "conditional - if inventory item was used", use inventory item 1 and add another action - Display("Testing.") - it works. Although the equivalent code is exactly the same as the one above. What's the problem?

Btw, if it's important, I'm using an older version of AGS.
Title: Re:Using inventory item on another inventory item
Post by: Ishmael on Thu 11/09/2003 05:21:07
instead of character[GetPlayerCharacter()].activeinv you could also try game.inv_activated, and see if this works.
Title: Re:Using inventory item on another inventory item
Post by: Pumaman on Thu 11/09/2003 21:38:05
If you're using the default inventory window, you need to use the  game.usedinv  variable to tell what was used.

The reason is that the new item does not actually become the active inventory until you click the "OK" button.
Title: Re:Using inventory item on another inventory item
Post by: Harvester on Fri 12/09/2003 00:49:40
Thanks, guys!
Notice how I often tend to blame my mistakes on "bugs" in the engine :-)