Game Development Community

Built-in pause for Console Debugging and Testing?

by Joe Sopko · in Torque Game Builder · 11/13/2009 (8:36 pm) · 8 replies

Has GarageGames implemented a built-in pause syntax (for input in the console) or hotkey while testing projects in order to check particular variables at particular instances? If not has anyone within the community made and publicized a script or mod for being able to do so? Also while I'm on the subject is there any common mods/scripts that the community commonly uses to acquire more flexibility, power, or overall helpful additional functionality in TGB? Thanks for your time and consideration.

#1
11/13/2009 (9:32 pm)
You can use echo() to print variables or strings to the console.

//strings
echo("This will print to the console");

//variables
echo(%x);
echo($y);

//variables appended to strings
echo("X is " @ %x);

For more advanced debugging features you'll need to use either Torsion or TorqueDev.
#2
11/13/2009 (9:56 pm)
Thanks for your response Scott. I'm aware of using echo() to print variables or strings to the console, I was curious if there was an ability to check what a particular value for a variable is at a given time, which is why I would like the ability to pause the game at a particular time. Is there a way in Torsion or TorqueDev to cout or echo() out values at particular lines in the script?
#3
11/13/2009 (10:06 pm)
You can set breakpoints in Torsion and TorqueDev and step through the script as well as set variables to watch.
#4
11/13/2009 (10:53 pm)
I searched "Breakpoints" and similar searches on GG's search bar, the TorqueDev Forums, and Google and I've looked around the TorqueDev interface. All I've come up with was F9 being the toggle breakpoints hotkey. Mind pointing me in the right direction or just giving a quick explanation? Thanks again Scott.
#5
11/13/2009 (11:30 pm)
I'll need some time to reinstall TorqueDev and see how it's set up these days. It's been a few years since I've used it. In Torsion, just like Visual Studio, you right click in the left margin of the script to insert a breakpoint. I'm pretty sure TorqueDev works in a similar fashion if not the same.
#6
11/14/2009 (12:16 am)
And it does. Right click on the line you want to set the break point on and select Toggle Breakpoint to set a breakpoint.
#7
11/14/2009 (11:11 am)
If you want to monitor a variable value in rutnime, you have multiple solutions:
- echo($variable); on onUpdate() call, which means every 33 miliseconds (or just schedule some custom interval)
This will print value of that variable frequently. (also you can activate windows console with enableWinConsole(true); that can help a little)

- the other solution is to put an text field into the stage, and frequently update that text field with the value of variable you wanna trace. That way you can easily monitor variable value in runtime, but you wont have a console log.
#8
11/14/2009 (5:10 pm)
Thanks a lot for all the help guys, this should be plenty for what I was looking for, much appreciated. Take it easy.