I have 2 questions: I need to find a way around this, or add these to AGS 2.8
Q1. I am trying to find out how to display a few values through the 'Label' in GUI. for example, I want to display the amount of cash using the label (but not displaying as a score (@SCORE@).
Q2. Is there anyway to activate an 'IF' command if the player types in a set string into the text parser. for example, the player sets a username as a string, then wants to log in, how do I set it so the parser recognises that I have typed in a certain string?
Q1:
lblCash.Text = String.Format("%d dollars", cash);
Where lblCash is your Label's script o-name and cash is your "cash" variable.
Q2:
I guess you're just looking for Parser.Said (http://americangirlscouts.org/agswiki/Parser_functions#Parser.Said).
String parsedText = txtParser.Text;
Parser.Parse(parsedText);
if (Parser.Said("username1")) {
// do stuff
}
else if (Parser.Said("username2")) {
// do other stuff
}
else {
String unknown = Parser.SaidUnknownWord();
if (unknown != null) Display("This parser does not recognize the word %s.", unknown);
}
Yer, Q1 looks answered but how do I create a variable called "Cash"?, and for Q2, I want the player to set the username as to anything like "error17" or something;
What do you mean you want to set it as to anything?
If you want to set the username in one place you could just store it in a String in the global script:
String username;
export username;
// set username function -- maybe the activation function for text box txtUsername
username = txtUsername.Text;
Be sure to import the variable in the script header:
import String username;
Then from any script (global or room script) you can do like this:
String enteredName = txtUserprompt.Text;
if (enteredName == username) {
// entered correct username
}
else Display("you entered the wrong username");
That only allows for one username, but it might be useful to know what you're trying to achieve.