Game Development Community

how to compile .cs scripts to .dso

by Peter Miller-Russo · in Torque Game Engine · 04/20/2002 (1:59 pm) · 9 replies

Hello all,

I searched but haven't found how to compile .cs scripts into .dso files. I've made changes to the .cs scripts and want to see the results.

I'm sure this is elementary but any response is appreciated!


Thanks,


Peter Miller-Russo

#1
04/20/2002 (2:05 pm)
It will automatically compile if you made changes, but some files have poor track records of recompiling when they are supposed to.

A simple fix is to delete the corresponding .dso file, and the engine will automatically compile the new script file from a .cs to a .dso
#2
04/20/2002 (3:06 pm)
Thanks that is good to know.

I found I was modifying the default.cs script but the prefs.cs script was overriding my changes!

Works now.


Peter
#3
07/28/2002 (2:52 pm)
That works great after modifying a .CS, but what about if you create a new .CS. Basically I created another weapon script, but when I run the test demo, it doesn't compile a .DSO. Does anyone know if there is another .CS that I need to modify to get it to compile my new weapon .CS?

thanks,
James
#4
07/28/2002 (3:30 pm)
You will need to exec() your script from some location first.
#5
07/30/2002 (8:04 am)
I kind of figured that. But where? I know that there has to be some script or something that compiles the "rifle" and "crossbow" scripts, but can't seem to find them. Thanks anyway, I'll keep searching.
#6
07/30/2002 (8:42 am)
I find it helps to have a reload function so you can keep tribes running and update your changes on the fly. Put something like the following in a random cs file:

function reload()
{
exec("newScriptFile.cs");
echo("reloaded");
}
#7
07/30/2002 (9:01 am)
If you are just adding a new weapon script and want to have it compile, take a look in the game.cs file. That's where most of the server scripts are exec().

exec("./rifle.cs");
exec("./crossbow.cs");
exec("./newweapon.cs"); // <--add this line
#8
07/30/2002 (9:17 am)
Cool! Many thanks, I'll take a look this evening. :)
#9
07/31/2002 (4:20 pm)
function CompileFiles(%dir)
{
   compileCSFiles(%dir);
   compileGuiFiles(%dir);
}

function compileCSFiles(%dir)
{
   %search = %dir @ "/*.cs";
   for(%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search))
      if(fileBase(%file) !$= "config.cs" && fileBase(%file) !$= "prefs.cs")
         compile(%file);
}

function compileGuiFiles(%dir)
{
   %search = %dir @ "/*.gui";
   for(%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search))
      compile(%file);
}

Then, somewhere in script, call the compileFiles function on your game/fps/rw directory and common directory.