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
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
About the author
#2
I found I was modifying the default.cs script but the prefs.cs script was overriding my changes!
Works now.
Peter
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
thanks,
James
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
function reload()
{
exec("newScriptFile.cs");
echo("reloaded");
}
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
exec("./rifle.cs");
exec("./crossbow.cs");
exec("./newweapon.cs"); // <--add this line
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
Then, somewhere in script, call the compileFiles function on your game/fps/rw directory and common directory.
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.
Torque Owner Matt Webster
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