Game Development Community

Onworldlimit "string always evaluates to 0" RC3 (real thread)

by Sam M · in Torque Game Builder · 06/14/2006 (8:18 pm) · 3 replies

Sorry about the double post.

Not sure if this is really a bug or not but it seems to be a problem since this worked in previous version of TGB. I have the function:

t2dSceneObject::onWorldLimit(%this, %limitMode, %limit)

And whenever I use something like:

if(%limit == "top");
//code

I get ther error "string always evaluates to 0" and the code doesn't get run. When I try:

switch(%limit)
{
case "top":
//code
case "bottom":
//code
case "left":
//code
case "right":
//code
}

It'll run the code for the first case, but not the other 3. Am I missing something here? Or is the problem something else?

Thanks in advance

#1
06/14/2006 (9:06 pm)
You need to use the $= operator to compare strings.
#2
06/14/2006 (9:19 pm)
Aha! I totally forgot about that, thanks alot.
#3
06/15/2006 (1:35 am)
And as for switch, you need to use switch$.