I scripted a script that scripts scripts. you know what those script scripted scripts do? they script scripts. beat that
if(!($scripts > 1) && !($scripts < 1)) //make sure we start counting at zero
$scripts = 1;
if($scripts < 50)
{
$fileObjectR = new FileObject();
$fileObjectW = new FileObject(); //open files
$fileObjectR.openForRead("add-ons/script_scripter/client" @ $scripts-1 @ ".cs");
$fileObjectW.openForWrite("add-ons/script_scripter/client" @ $scripts @ ".cs");
while(!$fileObjectR.isEOF()) //until end of this file
{
%line = $fileObjectR.readLine();
$fileObjectW.writeLine(%line); //copy line by line
}
$fileObjectW.close();
$fileObjectR.close(); //close files (is this even a thing in torque, I forget)
$fileObjectW.delete(); //prevent memory loss
$fileObjectR.delete();
$scripts++; //increment script count
exec("add-ons/script_scripter/client" @ $scripts-1 @ ".cs"); // keep going!
}
Tested this, it works. Name it client0.cs and put it in a folder in add-ons called script_scripter with a client.cs of:
$scripts = 1;
exec("add-ons/script_scripter/client0.cs");