Counter Problem (Solved)

Started by , Sun 29/01/2006 17:30:29

Previous topic - Next topic

crossedgun

I am unsure of what I am doing wrong here.

int Key;
   if (Key == 1) {
           Display ("It's already unlocked.");
   }
   if (Key == 0) {
           Display ("Hooray!  It unlocked.");
        Key = 1;
   }

When the action is done, it displays the "Hooray..."  but when I repeat the action, it "Hooray"s again.  Any suggestions?


(Figuring out how to do all this can be a real pain  :P)


DoorKnobHandle

#1
It's because you define "int key" right above where you use it. It will create a new "key" variable everytime you execute that piece of code (and it will always initialize the variable with a value of "0").

Move the "int key" to the global script file.

EDIT: What is strazer talking about..? :=


crossedgun

Thanks guys, it's working fine now.  Woohoo, I'm one more step closer to making my game!  ;D

SMF spam blocked by CleanTalk