Writing Scripts for Script Builder in TorqueScript

TIME : 2016-01-07
Writing Scripts for Script Builder in TorqueScript

Scripting depends on the language you're using, but here's an approach in TorqueScript, a personal favorite. First, you'll want a function that writes a premade script to a file.


function makeScript(%script)
{
%file = new fileObject();
%file.openForWrite($WhereEver);
%file.writeLine(%script);
%file.close();
%file.delete();
}

Then, at the bottom, you call it with lines like these:

$Script[1] = "function serverCmdDoStuff() {}";
makeScript($Script[1]);

For deleting a script, use this:

function deleteScript(%script)
{
filedelete(%script);
}

And that's all there is to it.