Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: pro_designer on Tue 15/08/2006 14:08:02

Title: password input
Post by: pro_designer on Tue 15/08/2006 14:08:02
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
Title: Re: password input
Post by: R4L on Tue 15/08/2006 14:34:40
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!  :)
Title: Re: password input
Post by: Khris on Tue 15/08/2006 14:57:11
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)
Title: Re: password input
Post by: Arcangel on Tue 15/08/2006 23:23:01
Or this

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