How to set up and compile a script
*note: sorry that the downloads contained in this file are no longer available.
In this set of tutorials I will hopefully explain how to get scripts to run, and go through some of the basic commands. For more information take a look at the scripting doc that comes with the SDK. You can also learn from the sample scripts, so have a look through them too. I'll assume you've downloaded the SDK, and installed it in its default path, that you know the basics of entity use in SofRadiant and are familiar with editing files in Notepad.
First open the "sample\ds" folder located in the SDK directory. Make a new folder and call it "test". Copy the "SoFDS.exe" file from the "SDK\bin" directory into this folder. This is the script compiler. There are 2 types of scripts files ".ds", which are un-compiled scripts and ".os" which are the compiled scripts the game runs. Now to make life easier create a batch file to run the compiler, with the following 2 lines in it. Save it as "compile.bat". cd c:\progra~1\sofsdk~1\sample\ds\test sofds test Obviously substitute the path for your path to the "sdk\sample\ds\test" folder. Ok now we're ready to start scripting.
The output directory needs to be present before we compile so make a folder in your "SoF\base" directory called "ds", and then in this folder create another called "test". You should end up with something like "c:\games\sof\base\ds\test". Download the blank script here, and open it in Notepad. Change the output path to point to your "Sof\base\ds\test" folder. This just tells the compiler where to put the compiled script. If the path isn't present it will put it in the root directory. NOTE. You must use forward slashes "/" instead of backwards slashes "\" in the path name. The include line tells the compiler to include the "header.ds" file when compiling, this contains some pre-defined variables. Now save the script in the "sdk\sample\ds\test" folder as "test.ds" Ok, lets make sure it compiles, run the compile.bat file. You should get something like the following in a dos window.
C:\Program Files\SoF SDK\Sample\ds\test>cd c:\progra~1\sofsdk~1\sample\ds\tes
C:\Program Files\SoF SDK\Sample\ds\test>sofds test DesignerScript Compiler V1.0 (Dec 22 1999 19:03:38)
Processing test.ds... Wrote C:\games\sof\base\ds\test\test.os... Size: 420
C:\Program Files\SoF SDK\Sample\ds\test>
If you look in the output folder there should now be a file called "test.os". If all is well move onto the next tutorial. |