More password help needed...

Started by Yo Mama!, Sat 10/04/2004 18:45:09

Previous topic - Next topic

Yo Mama!

Ok, I have pretty much had it trying to get this stupid password thing to work properly. How do I do it correctly? Do I put the script in the rooms' script, or the GUI script? I don't really see why it isn't working. I have a seperate GUI with just an input box in it, and when the player enters a computer screen room, the GUI is turned on in the proper location. I want the player have to type the right password (not case sensative) then press enter, then it comes up with a secret message. If the player doesn't come up with the right password, I want nothing to happen. Here is the code I thought would work in the GUI script:

if (interface == 3) {
 if (IsKeyPressed(13) == 1) {
string input;
if (StrComp("password",input)==0)
   { Display ("Message Here"); } }
     
     
 }  // end if interface 3

Anything wrong with what I'm doing? It doesn't come up with any error messages, but it just doesn't work.

Scorpiorus

You need to fill your input string with what player typed-in:

if (interface == 3) {

   if (button == INPUT_BOX_OBJ_NUMBER) { // runs on enter pressed

      string input;
      GetTextBoxText (interface, button, input);

      if (StrCaseComp("password", input)==0) { //case insensitive
         Display ("Message Here");
      }


   }

}

~Cheers

Yo Mama!

YES! Thank you so much  ;D! That was driving me crazy!

SMF spam blocked by CleanTalk