password input

Started by pro_designer, Tue 15/08/2006 14:08:02

Previous topic - Next topic

pro_designer

I'm making a game where there's a bomb and you need to put in a password for it.
How do i put in a text enter screen? ty

R4L

#1
Ok, here it is. Put this in your room script, under Player Enters Room (after fadein):

String pass = "Water";
String password = Game.InputBox("Please enter a password:");
if(password.CompareTo("Water") == 0)
{ Display("Permission Granted.");
return;
}
else {
Display("Permission Denied.");
Display("That was the wrong password.");
}Ã, 

String pass doesn't have to be Water. Put your password where Water is, anywhere you see Water, put your password. Basically this code stores your password in String pass, then stores whatever the player typed in the input box into String password. Then the if statement compares the two to see if the strings are the same, then lets you in if your right or keeps you out if your wrong. 

Im learning the newer AGS too, but now I think I have grown fond of these new string types. I absolutely love them!  :)

Khris

#2
Use the forum search before asking question like this.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=25366.0

Edit:
Rap4Life42o, you probably meant to write:
if(password.CompareTo(pass) == 0)

Arcangel


SMF spam blocked by CleanTalk