Game Development Community

Where can I find documentation about the functions?

by Adam Johnston · in Torque Game Builder · 09/23/2005 (3:29 pm) · 4 replies

Hello
I'm doing my hello world scripts in TorqueScript
and I can't find the reference for example:

setLogMode();
echo();

etc, etc...

There MUST to be some place with all the function reference
something like any API free or commercial have :(
please tell me where....

#1
09/24/2005 (1:49 am)
The TGE source is commented with doxygen tags which you can use to automatically generate html documentation (sort of like javadoc, but better, I think). I've only tested it with standard TGE, but you should be able to just do "make html_docs", as long as you have doxygen installed and setup.

Or you could take a look at this resource. It's aging, but I use it still.
Not sure if it's restricted to TGE license owners or not.

--
Hans
#2
09/24/2005 (5:22 am)
For C++ engine source code documentation, this might help: www.garagegames.com/docs/tge/general/ch06s12.php

You're Adam Johnston about Torque 2D, not TGE, right? And you're asking about TorqueScript, right?

This works in both T2D and TGE: To list all the functions and classes available to TorqueScript, try DumpConsoleClasses(); and DumpConsoleFunctions(); from the console (~).

To dump them to a file instead of the console, put this in your code somewhere, then call writeOutFunctions(); and writeOutClasses(); It will create files that list all of the available functions and classes. Neat stuff. There's some comments that let you know what the functions are for.

// Writes out all script functions to a file
function writeOutFunctions() {
new ConsoleLogger( logger, "scriptFunctions.txt", false );
dumpConsoleFunctions();
logger.delete();
}

// Writes out all script classes to a file
function writeOutClasses() {
new ConsoleLogger( logger, "scriptClasses.txt", false );
dumpConsoleClasses();
logger.delete();
}

Also, Torque2D came with some documents in the Torque2D/SDK/doc folder: Basic Tutorial, Debug Banner, Technical Overview, Reference, Tile Editor.

There are a lot of TGE TorqueScript documents (links are in the "TorqueScriptDocumentationLinks.htm file that came with Torque2D). Much of that applies to Torque2D as well as TGE.

You aslo have some really good examples (fishdemo, spacescroller) to play with and learn from. Last resort, you do have the C++ source code to go figure out what's going on behind the scenes.

That's pretty impressive documetation for an early-adopter release! The formal documentation will, no doubt, be part of a future release. This is what is says on the page where you bought it: "This is an early adopter release. Torque 2D is not yet complete and major components may change as it gets improved for the final release. It is an advanced stable game platform available for developers who want to get an early jump on 2D game development." And in the beginner's tutorial they let you know that the documentation will be added to as the T2D engine is developed and finalized. It isn't done yet, so be patient -- they have really done a great job of documentation for those of us who didn't want to wait for completed T2D engine. ... and you can find help in these forums, too...
#3
09/24/2005 (5:37 am)
SetLogMode(%mode);
%mode=0 = disable logging (not console.log file generated)
1 = append to console.log
2 = overwrite console.log each time you start the game
5 = like 1, but all console contents before the SetLogMode are included
6 = like 2, but all console contents before the SetLogMode are included

echo("text message"); // sends black "text message" to the console...
warn("text message"); // sends gray text to the console...
error("text message"); // sends red text to the console...

You can also do stuff like echo("My local variable %localVar currently equals" SPC %localVar);

You get to the console during gameplay by pressing the tiled (~) key...

As long as we're talking about functions that are very useful for debugging, have you tried tree(); from the console? Neat stuff... inspect the contents of variables during runtime, etc...

You can also get a great editor/debugger from http://www.torquedev.com/. It will point you toward some good TorqueScript tutorials for TGE, which will help you get around in T2D.
#4
09/24/2005 (9:40 pm)
Thanxs to all, I'll be doing that.

@Hans: I was looking something like that.

@Jason: The indicated functions were very helpfull. Thanxs.

By the way I could find some more information in the
book Programming all in one (appendix A), even if this is for TGE
seems TD2 shares many commands.