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.
instead of character[GetPlayerCharacter()].activeinv you could also try game.inv_activated, and see if this works.
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.
Thanks, guys!
Notice how I often tend to blame my mistakes on "bugs" in the engine :-)