Game Development Community

Generate your own Torquescript documentation HOWTO

by Alex Rice · in Torque Game Builder · 05/23/2006 (8:27 am) · 6 replies

I was going to post this on TDN but gave up - I am a WikiDiot I guess. If anyone has the wherewithal please go ahead and post it in TDN in the TGB script reference section.

Quote:
Referencing TGB Beta 3 - May 23 2006 (edit - works same with beta 4)

Torque has a useful self-documentation tool: dumpConsoleFunctions() and
dumpConsoleClasses(). Here is the quick and dirty way to run those commands to generate a
list of all available functions and classes:

1. Launch games\T2D.exe
2. Type "~" key to open the console
3. Type dumpConsoleFunctions(); ENTER
4. Type dumpConsoleClasses(); ENTER
5. Type quit(); ENTER
6. TGB will quit.
7. See console.log in same directory as T2D.exe. It is ~ 400 KB in size now.
8. Open console.log with a text editor (e.g. Notepad)
9. Cut out all the text from the top of the file down to where you called dumpConsoleFunctions();
10. Search for dumpConsoleClasses(); and cut out that line
11. Scroll to bottom and cut out from quit(); down to end of file.
12. Save console.log as torquedocs.txt or whatever filename you want.

Now you have documentation (or at least a listing) of every single function and class in
the Torque Core as well as TGB. Hurrah! If you start to dig though there is about 100KB of
definitions that is distracting - everything from the level builder, the IDE, your current
project, etc. For example LevelEditorTileMapTool is listed but you probably don't need to
see it in there. This stuff needs to be removed. [edit: actually LevelBuilder* is a lot of C++
classes so they are going to always be listed. However much can be trimmed using the following.]

Here is a way to clean it up so it only has the core Torque and TGB instead of the extra
stuff. Perform these steps, then repeat the previous steps.

1. Launch games\T2D.exe
2. File > New Project
3. Project name > DOCS
4. Project template > Empty Game - no levelbuilder
5. Create
6. Now you see a window with no close button, and no on-screen controls (just the splash
screen). OK we can deal with it.
7. Type "~" key to open the console
8. Type quit(); ENTER
9. Edit games\main.cs and make 2 changes:
10. $runWithEditors = false;
11. $defaultGame = "DOCS";
12. Now when you launch T2D.exe it's a barebones project with only the core functions and
classes loaded. This is the ideal state to generate your Torque docs from.
13. Perform steps 1-12 above to generate the torquedocs.txt again.
14. Read & search torquedocs.txt with your fave text editor
15. Advanced option:
Use doxygen to convert torquedocs.txt into other browseable/searchable doc formats. TGE
used to include a doxygen config file that could be used for this purpose.

#1
05/23/2006 (10:32 pm)
After following the above procedure, and using Doxygen and HTML Help Workshop to compile the html help, I have a rockin browseable searchable consolidated helpfile for both Torque core and TGB. Should I post this .chm file as a resource for TGB users? It's about 3MB in size.

mindlube.com/garagegames-forum/doxygen.JPG
#2
05/23/2006 (11:07 pm)
Ohhhh. I think you may want to wait for an Employee to say yay or nay about posting that somewhere, it looks to be all that GG people want to not release to the public

However that looks like OODLES of creamy HTML help goodness that I'd kill for
#3
05/24/2006 (12:01 am)
To help out those you hate to cut and paste , and they have a copy of perl handy...

make a little ripper script in your console.log dir to rip the information from the log.


#!/usr/local/bin/perl
open(CONSOLE,"< console.log") || die $!;
open(DOC,">  doc.out") || die $!;
my $rip = 0;
while(<CONSOLE>)
{
	if ($_=~/^\=\=\>dumpConsoleFunctions\(\)\; /)
	{
	  	$rip = 1;
	  	next;
	};
	if ($_=~/\=\=\>dumpConsoleClasses\(\)\;/)
	{
	 	print DOC "\n";
	 	next;
	}
	if ($_=~/^\=\=\>quit\(\)\;/)
	{
	   $rip = 0;
	};
	if ($rip)
	{
		print DOC $_;
	};
};
close(DOC);
close(CONSOLE);

now in about 200ms you have a clean little doc.out file containing the useful information Alex was kind enough to show how to get.

Great find Alex!
#4
05/26/2006 (10:36 pm)
Alex, I think a lot of people would really love that as a TGB resource, myself included.
#5
05/27/2006 (10:09 am)
That's just awsome!

Will you marry me Alex?

:)

(Hopefully GG team will like it so much that they include it in TGB download.)
#6
05/27/2006 (11:01 am)
I'm going to wait until TGB final version & then submit it resource. In the meantime if anyone wants it just email me . Assuming you are in this forum then you have a TGB license.

Couple things to note that it doesn't show all the callbacks available for all the objects, and TGBReference.pdf contains much more detailed info about the TGB members and functions. However I'm using the helpfile a lot and between it and TGBReference.pdf I am pretty much in documentation heaven right now!