I'm trying to make an "enter your name" GUI. It works, but I would like a default name to appear when nothing is entered in.
In other words, if the player types "George", then the character's name will be "George". But if the player just clicks OK without entering a name, then his name will be "Carter". Kinda like in the beginnings of the AGI Space Quest 1 & 2 .
Here's the code I used. I can't figure out, for the life of me, why it won't work:
// ##### INPUTWINDOW #####
if (interface == 10) {
SetMouseCursor (6);
if (button == 2){
string charname;
GetTextBoxText(10, 0, charname);
if (charname == ""){
StrCopy(charname,"Carter");
}
StrCopy(character[EGO].name, charname);
GUIOff(10);
SetDefaultCursor();
Wait(1);
Display("Your name is %s.", character[EGO].name);
}
}
Quotecharname == ""
This is not allowed. You have to use StrComp/StrCaseComp to check string values.
Gotcha! I understand and it works perfectly. Thank you, good sir!
You're welcome! :)