I'm making a level 2 to a game I've already made, and I have it so they need a password from beating the first level, to play the second level. I have a textbox come up where they can insert the password. If they get it right, it starts the game, and if they get it wrong, it changes the text box text to "Wrong Password." I then want to make it so the next time they press a key, it clears wrong password and inserts whichever key they pressed. Is there a way to do this? I think on_key_press doesn't work when a text box is up so I need another way of finding out what key they pressed. Also I thought maybe there's a way of having it automatically select the text in the box, so the next character they type, replaces wrong password.
Does anyone know how to do this?
You can handle the password input via repeatedly_execute:
string password;
string input;
game_start:
StrCopy(password, "abcdef"); // correct password
repeatedly_execute:
GetTextBoxText(GUI, TEXTBOX, input);
if (StrComp(input, password)==0) {
Display("Password is valid!");
SetTextBoxText(GUI, TEXTBOX, "");
} else {
if (StrLen(input) > StrLen(password)) {
StrFormat(input, "%c", StrGetCharAt(input, StrLen(input)-1);
SetTextBoxText(GUI, TEXTBOX, input);
}
}
Also take a look at that thread http://www.agsforums.com/yabb/index.php?topic=8231.0 about the password implementation.