Door always opens.

Started by Kinoko, Tue 17/02/2004 16:00:41

Previous topic - Next topic

Kinoko

I'm trying to get an opening/closing door thing going. I have a "door" as an object and in it's interactions, under ext. modes, I have this code:

if (UsedMode("open")) Go();
ObjectOff(0);

if (UsedMode("close")) DisplaySpeech (EGO, "It's already closed.");

Opening the door works fine, but when I click close on the door, the speech is displayed AND the Obejct is removed, hence opening the door.

Why is it adding in that extra ObjectOff action when it hasn't been specified?

SSH

You want:

[if (UsedMode("open")) {
Go();
ObjectOff(0);
}

if (UsedMode("close")) DisplaySpeech (EGO, "It's already closed.");



if you dont use braces around the if code, it will only treat the first statement as being conditional: the other statements will ALWAYS run...
12

Kinoko

Oh, thanks! Works like a charm now :)

SMF spam blocked by CleanTalk