- Home /
Question by
TheJakanator · Jun 05, 2015 at 04:11 PM ·
guitext
Checking 2 string variables
I am trying to make a text based horror game, but the code input doesn't equal the answer. Help!
var codeinput : String = "";
var curQuestion : String = "Welcome to the L.D.T.C Initiative. Do you want to begin?";
var Answer = "";
function OnGUI () {
// Make a text field that modifies stringToEdit.
codeinput = GUI.TextField (Rect (100, 200, 200, 25), codeinput, 25);
if(GUI.Button(Rect(100,250,60,30),"enter")) {
codeinput = Answer;
//check to see if that varible = code.
}
GUI.Label (Rect (100, 75, 1000, 1000), curQuestion);
}
function Start () {
}
function Update () {
if(curQuestion == "Welcome to the L.D.T.C Initiative. Do you want to begin?" && Answer == "yes"){
curQuestion = "L.D.T.C Loaded. Would you like to learn more? Or continue?";
if(curQuestion == "L.D.T.C Loaded. Would you like to learn more? Or continue?" && Answer == "learn more"){
curQuestion = "the Long Distance Troop Control program is made to assure victory in any circumstance. Would you like to continue the operation?";
if(curQuestion == "the Long Distance Troop Control program is made to assure victory in any circumstance. Would you like to continue the operation??" && Answer == "no"){
curQuestion = "SYSTEM ERROR. CONTINUING OPERATION";
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Trailing effect with GUI 0 Answers
GUI Text Score counter 3 Answers
Gui Text Script 4 Answers
Intro GUI Text Script... 3 Answers
Problem Displaying Score on GUI text 0 Answers