Help with Inventory Conditional

Started by OftenK, Fri 25/06/2004 01:08:15

Previous topic - Next topic

OftenK

I know what I want to happen, but I don't know how to put into the scripting language.
What I want to happen is this: If player has used a certain inventory item on object 1, then hotspot 3 runs a different script than it normally would when clicked on.

The "Conditional--If Inventory Item was Used" only lets me change the reaction of the object, when I want to change the reaction of the hotspot. See?

If haven't made myself clear enough, I'll re-explain if I need to.

As always, any help is greatly appreciated, and rewarded with eternal gratitude and cupcakes. And possibly puppies.

--OftenK

Wolfgang Abenteuer

What you have to do is set some sort of variable that tells the game if the player has clicked the inventory item on the object.Ã,  Something like this:

Under the "If inventory item was used on object" script:

itemclicked = 1;
//Whatever other code you need


Then under the hotspot interaction:

if (itemclicked == 0) { //Player HASN'T clicked the item on the object
Ã,  //Run whatever code goes here
}
else if (itemclicked == 1) { //Player HAS clicked the item on the object
Ã,  //Run whatever code goes here
}


~Wolfgang

OftenK

Quote from: Wolfgang Abenteuer on Fri 25/06/2004 01:12:56
What you have to do is set some sort of variable that tells the game if the player has clicked the inventory item on the object.Ã,  Something like this:

Under the "If inventory item was used on object" script:

itemclicked = 1;
//Whatever other code you need


Then under the hotspot interaction:

if (itemclicked == 0) { //Player HASN'T clicked the item on the object
Ã,  //Run whatever code goes here
}
else if (itemclicked == 1) { //Player HAS clicked the item on the object
Ã,  //Run whatever code goes here
}


~Wolfgang

It gives me an error saying "Error compiling your script. The problem was: In: 'Main Script' Error (line 8): Undefined symbol "itemclicked".

I must be doing something wrong. I'm puttin the first bit of script in the object interaction, and the last two bits in the hotspot interaction...right?

Wolfgang Abenteuer

Right, but you need to first define the integer before you can use it.  Just put:

int itemclicked;

in the top of the room script (just click the double-brackets button in the room editor for that room and type it at the very top, before any room functions are declared).

~Wolfgang

OftenK

Ha ha! Beautiful!

Thank you, sir. You've been a huge help!

SMF spam blocked by CleanTalk