Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Wed 21/07/2004 01:16:24

Title: GetTextboxText working fine, if statement dud.
Post by: on Wed 21/07/2004 01:16:24
I've used GetTextBoxText to get the contents of a text box in a GUI, and according to the value returned by the Display() buffer, it works. However, I try using this if statement, and it smegs up.

I've not slept in a day or so. That could be the reasoning behind it. Whatever the textbox content, the script decides to use the else condition even if theoretically, the first if condition should match.

GUI Code:


   if (interface == 3){
      Ã,  if (button == 3){
      Ã,  Ã, string input;
         GetTextBoxText (3, 3, input);
         Display ("%s", input);
         
      Ã,     Ã,  Ã, if (input == "topsecret"){
         Ã,  Ã,  // done it.
         Ã,  Ã,  Display("Clever.");
         Ã,  Ã,  }else {
         Ã,  Ã,  Display("Think simple.");
         Ã,  Ã,  }
         Ã,  }
         }

I used AGS for a bit, took a break, forgot most of it and I'm just coming back to it. So forgive any re-established n00bism.

Cheers.
Title: Re: GetTextboxText working fine, if statement dud.
Post by: SSH on Wed 21/07/2004 01:35:17
You are Yahtzee and I claim my $10!  ;)

Try StrCmp instead of == in your if statement...
Title: Re: GetTextboxText working fine, if statement dud.
Post by: on Wed 21/07/2004 02:17:06
Gah. I swear I use too many C-syntax languages.
I'll give that a whirl, cheers.