How can you find a syntax error in a script?
by kcpdad · in Torque Game Engine · 07/24/2004 (5:19 am) · 3 replies
Hi,
How can you find a syntax error in a script? I noticed that tge.exe doesn't seem to report syntax errors even when I enable trace with trace(true); at the start of the module.
E.g. I write a main.cs with just these lines
$logModeEnable = true; // track the logging state we set in the next line
SetLogMode(2);
trace(true);
Echo("In main.cs\n");
asdfadf
Echo("End of main.cs\n");
When I run tge.exe from a command prompt it hangs, I kill the command prompt(another question, if I Ctrl-C tge.exe I don't get a console log but if I close the command prompt I do, why??)
The console log just shows
C:\Emaga4>type console.log
//-------------------------- 7/24/2004 -- 09:29:25 -----
Console trace is on.
In main.cs
No error message about the invalid syntax, this obviously makes it very difficult to correct these types of errors.
Thanks!
Joe
How can you find a syntax error in a script? I noticed that tge.exe doesn't seem to report syntax errors even when I enable trace with trace(true); at the start of the module.
E.g. I write a main.cs with just these lines
$logModeEnable = true; // track the logging state we set in the next line
SetLogMode(2);
trace(true);
Echo("In main.cs\n");
asdfadf
Echo("End of main.cs\n");
When I run tge.exe from a command prompt it hangs, I kill the command prompt(another question, if I Ctrl-C tge.exe I don't get a console log but if I close the command prompt I do, why??)
The console log just shows
C:\Emaga4>type console.log
//-------------------------- 7/24/2004 -- 09:29:25 -----
Console trace is on.
In main.cs
No error message about the invalid syntax, this obviously makes it very difficult to correct these types of errors.
Thanks!
Joe
About the author
Hobbyist working on a tank game when time allows. Play the prototype at => http://www.sytrept.com/60tons/
#2
The lesson I learned: the root main.cs is the keystone to this archway called Torque. pull it out, and none of the other building blocks will do their job. I'm kinda happy I have a bad habbit of making typos while rushing to input other people's code. :P Think of the wonderful learning experience I would have missed if I typed it right the first time.
-Matt
08/25/2004 (5:36 pm)
Finding out that root main.cs is a special case relieved a major stumbling block of mine when I was first inputting the CH4 code. I enabled trace, and it didn't seem to work. The code was not progressing linearly as I thought it would, as I was trying to embed echo statements throughout the inline section to catch the exact area where my code was hanging up. Upon this failing and reading ben's comment above, I went over my root main.cs with a fine tooth comb again, and found a very *very* stupid, hard to spot mistake on my part. Once The mistake was patched, everything worked like a charm, including Trace. The lesson I learned: the root main.cs is the keystone to this archway called Torque. pull it out, and none of the other building blocks will do their job. I'm kinda happy I have a bad habbit of making typos while rushing to input other people's code. :P Think of the wonderful learning experience I would have missed if I typed it right the first time.
-Matt
#3
08/28/2004 (11:01 am)
I'm glad you figured that out. Eloquent explanation. :)
Associate Kyle Carter