Game Development Community

Scripting tip

by Tony Richards · in Torque Game Engine · 08/15/2001 (7:25 pm) · 1 replies

Ok, so you've compiled the V12 engine and you want to do a little scripting. Something you might want to add is a function in the engine that you can call from the script language. Something else that might be useful would be a list of all the available builtin functions, so here's my contribution... both at once!

Add the following source file (I called it MyExtensions.cc) recompile, run, get to the console window by hitting the the ' key, then enter

usage();

and you'll get a list of all available script functions.... pretty cool eh?

#include "platformX86UNIX/platformX86UNIX.h"
#include "platform/platformInput.h"
#include "platform/platformVideo.h"
#include "platform/event.h"
#include "platform/gameInterface.h"
#include "console/console.h"
//#include
//#include
#include

#ifdef LOG_INPUT
#include
#include
#endif

ConsoleFunction(usage, void, 1, 1, "usage()")
{
argc; argv;

ConsoleConstructor *p = ConsoleConstructor::first;
while(p)
{
Con::printf("%s\r", p->usage);
p = p->next;
}
}

About the author

I am the founder of IndieZen.org, a website dedicated to the Indie 2.0 Revolution where a number of Indie game development studios and individuals collaborate and share a suite of custom built open source game development tools and middleware.