Author Topic: 'String always evaluates to 0' problem.  (Read 898 times)

I have a problem, With two of my commands, i am getting this error when i exec the script.
Example:
function ServerCmdSomething(%c,%t1,%t2)
{
switch(%t1)
case "blah":
switch(%t2)
{
case "Blah2":
%c.hidenode("ALL");
case "Blah3":
%c.unhidenode("ALL");
}
case "Blah4":
switch(%t2)
{
case "Blah5":
%c.hidenode("Headskin");
case "Blah6":
%c.unhidenode("Headskin");
}
}

does anyone know why that failed?

function ServerCmdSomething(%c,%t1,%t2)
{
switch$(%t1)
case "blah":
switch$(%t2)
{
case "Blah2":
%c.hidenode("ALL");
case "Blah3":
%c.unhidenode("ALL");
}
case "Blah4":
switch$(%t2)
{
case "Blah5":
%c.hidenode("Headskin");
case "Blah6":
%c.unhidenode("Headskin");
}
}

The switch keyword only checks for numbers rather than strings, for efficiency. Use switch$ instead.