an object in a drawer

Started by beaver, Thu 13/05/2004 02:47:56

Previous topic - Next topic

beaver

Hi, I have made the drawer, i have made the item for inside it.
I have a hotspot that when clicked brings up an object which is a view of the drawer open. the hotspot also brings up the item that is inside the drawer using the switch item back on command. the only problem is that when the item is taken and the drawer is closed, the item reapears once the drawer is opened again.
Is there a command to switch the item off completly? or am i simply doing it wrong?

thanks for any help.

Darth Mandarb

if (character[GetPlayerCharacter()].inv[X] > 0) { [color=00AA00]// checks to see if it's in inventory[/color]
DisplayMessage("The drawer is empty.");
else {
ObjectOn(0); [color=00AA00]// drawer open picture (whatever # it is)[/color]
ObjectOn(1); [color=00AA00]// object in drawer (whatever # it is)[/color]
}

.inv[X] = the object from the game's inventory (the object in the drawer)

This will check to see if you have the object (inv[X]) in your inventory.Ã,  If you do have the object (meaning you've already taken it from the drawer) it'll just say "the drawer is empty".Ã,  However, if you don't have the object, it'll go ahead and perform what you've already scripted.

Does this make sense?

You could also make the drawer open (instead of saying "it's empty") but not turn on the inventory object if you've already got it.

beaver

i tried the one u did, and it said error string with non string or something on the line with the message in.
Then i tried it the way i want it and it said parse error at else
here is the script

if (character[GetPlayerCharacter()].inv[4] > 0) {
ObjectOn(4);
else {
ObjectOn(4);
ObjectOn(1);
}

Gilbert

if (character[GetPlayerCharacter()].inv[4] > 0) {
ObjectOn(4);
} else {
ObjectOn(4);
ObjectOn(1);
}

beaver

ah thanks, i just managed to get it to work but i had to make it run 2 scripts, thats alot better.

thanks.

Darth Mandarb

Damn brackets!!

Sorry 'bout that.

~ d

TerranRich

I'd like to take this opportunity to unveil the debut of a new Beginners' image:



This is only a light tease, don't take it personally. :) It happens to ALL of us! :D
Status: Trying to come up with some ideas...

Gilbert

hehe yeah, happened to me too. I once spent nearly an hour to track down my mistakes on braces.

SMF spam blocked by CleanTalk