Using inventory item on another inventory item

Started by Harvester, Thu 11/09/2003 00:32:57

Previous topic - Next topic

Harvester

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.
None shall pass!

Paranoid Factor

Ishmael

instead of character[GetPlayerCharacter()].activeinv you could also try game.inv_activated, and see if this works.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Pumaman

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.

Harvester

Thanks, guys!
Notice how I often tend to blame my mistakes on "bugs" in the engine :-)
None shall pass!

Paranoid Factor

SMF spam blocked by CleanTalk