Game Development Community

Strange TorqueScript array difficulties

by Alex Huck · in Torque Game Engine · 12/27/2006 (7:17 pm) · 3 replies

Here is my Console.log of the problem:

==>exec("./starter.rts/client/ui/populous/spells/registerSpells.cs");
Compiling ./starter.rts/client/ui/populous/spells/registerSpells.cs...
./starter.rts/client/ui/populous/spells/registerSpells.cs Line: 4 - parse error
>>> Advanced script error report.  Line 4.
>>> Some error context, with ## on sides of error halt:
iconPosition[1] = "17 451";
$iconPosition[2] = "49 451";
$iconPosition[3] = "80 451";
$iconPosition[4] = "17 407;
##$##iconPosition[5] = "49 407";
$iconPosition[6] = "80 407";
$iconPosition[7] = "17 363";
$iconPosition[8] = "49 363";
$iconPosition[9] = "80 363";
$iconPosition[10] = "17 319";
$iconPosition[11] = "49 319";
$iconPosition[12] = "80 319";
$iconPosition[13] = "17 275";
>>> Error report complete.

My file looks like:
$iconPosition[1] = "17 451";
$iconPosition[2] = "49 451";
$iconPosition[3] = "80 451";
$iconPosition[4] = "17 407;
$iconPosition[5] = "49 407";
$iconPosition[6] = "80 407";
$iconPosition[7] = "17 363";
$iconPosition[8] = "49 363";
$iconPosition[9] = "80 363";
$iconPosition[10] = "17 319";
$iconPosition[11] = "49 319";
$iconPosition[12] = "80 319";
$iconPosition[13] = "17 275";
$iconPosition[14] = "49 275";
$iconPosition[15] = "80 275";
$iconPosition[16] = "33 231";
$iconPosition[17] = "65 231";
(There is more code below this, but it's beyond the scope of this syntax error [I assume])

I am 99.99% sure the syntax is correct, but why does it say it isn't? Am I overlooking something? I've done this tons of times.

So far I've tried resetting Torque, deleting DSOs, and staring at my syntaxically perfect array for several minutes (There must be something I'm missing though, some 'mundane detail', as Michael Bolton (Office space) would call it)

Furthermore, typing the array in line by line in the console comes out fine, no errors...

#1
12/27/2006 (7:21 pm)
Check this line...

$iconPosition[4] = "17 407;


....close quote is missing after 407 and before ;

also it looks like your first $iconPosition doesn't have a dollars sign in front of it.

PS. Don't you hate these kind of bugs? ;-) Especially all the stuff you did to find it, delete dso's etc. I usually end up reinstalling Windows before I find the syntax error :P
#2
12/27/2006 (7:52 pm)
Whew, I knew there's be some kinda little tiny thing like that, many thanks. I can't believe I stared so long without catching that.. Right now it sticks out like a sore thumb... I went to even more trouble than just dso deleting, I commented out all the other code from that file +200 lines... lol

And yes, the $iconPosition has the $, it just didn't say so in the error report. I think the error reporting needs a bit of work,
1) make it not cut off the $, it gets confusing
2) make it put the ##'s on the correct line, line 4 in this case, not 5
#3
12/27/2006 (8:11 pm)
I'm glad I could help. Many people have helped me in the past for just the same sort of error. I always curse myself when I find these bugs.

I think there might be a forum for bugs in Torque somewhere.