Problems with strings and if/else statements
by amaranthia · in Torque Game Builder · 11/06/2006 (3:18 pm) · 2 replies
I'm not quite sure what I'm doing wrong, but no matter what I do, this statement always evaluates true, even though it shouldn't.
Okay, what's weird about this is that %this.type shouldn't be evaluated true by this if statement, but when I run my game, it:
a) evaluates true
b) goes through the if statement
c) updates the guiType, and displays "p" to the user.
I don't know what I'm doing wrong... :O
%this.type = "p";
if (%this.type = "e")
{
guiType.setText(%this.type);
}Okay, what's weird about this is that %this.type shouldn't be evaluated true by this if statement, but when I run my game, it:
a) evaluates true
b) goes through the if statement
c) updates the guiType, and displays "p" to the user.
I don't know what I'm doing wrong... :O
Torque 3D Owner Richard McKinney
Default Studio Name
Use $= to compare strings, and == to compare numbers. = is only used for assignments.