Game Development Community

Debugging General Question

by Terrance Simkin · in Torque Game Builder · 10/16/2006 (10:37 am) · 3 replies

Well I am a nubie at Torquescript with Torque Game Builder. Working on tutorials now.

Is there a means to debug errors? For exampls in Adobe Flash Actionscript there
is a trace() function that outputs to a window strings of information. This can be
be is to trace when something is happening or to confirm a value at a set point
in the program. For example:
trace("inside fastEvent number = " + number);

Thanks, any help to prevent just trial and error that I have been doing would be great!!!!!!

Professor Terrance "Terry" Simkin

Program Coordinator Animation and Graphic Game Programming
Professor Computer Engineering Technology
New Hampshire Technical Institute
31 College Drive
Concord, NH 03301
tsimkin@nhctc.edu

#1
10/16/2006 (4:36 pm)
There's the good old printf style of debugging that will output messages to your console.log using:

echo("This is a message that will appear in the logs loop counter =" SPC %i );
error("This also appears in the logs but will appear red in the console too");

Aside from that, you can try one of the script IDE's that offer debugging support with variable watches, single step, breakpoints etc

Torsion is worth a look, still in development, but it sounds like the end is not too far away and it's certainly usable/useful in its current state.
#2
10/17/2006 (2:02 pm)
I use Torsion every day and I think it's great. There were a few bugs initially, but now it's pretty solid. The ability to drop break points wherever I want in script is priceless.
#3
10/20/2006 (5:55 pm)
Torsion is great...

also there is a trace() function in TGB

trace(true/false);
trace(1/0);

it will dump the entire script callstack to the console.

ADD:

trace is useful to wrap in a set of calls your unsure about

trace(true);
callFunction()
trace(false);

and the entire callstack (including values passed) for all script calls will be dumped to the console.

Also tree() is a very helpful function :)