Firstly, the related wiki articles and a helpful link:
To start, we write a script. We'll keep this simple. This is a LoadACS tutorial, not an ACS tutorial, so if you don't understand how to work ACS to begin with, start here: http://zdoom.org/wiki/A_quick_beginner's_guide_to_ACS and work your way up.
#Include "zcommon.acs" //ACS needs this, generally
Script 600 ENTER //Use a number you're reasonable sure won't be used in a map
Generally, you would want to write this in a map editor like Doom Builder, in a quick test map, to weed out any scripting errors before you try to compile it for real.
Next, after you have the script written into a normal .txt (We'll say SOMEACS.txt), drag and drop it into ACC.exe, which can usually be found in your Doom Builder directory. If it compiled successfully (and this is why you try it in Doom Builder first, so you can see the errors), then you should have SOMEACS.o. Import this file into your wad between A_START and A_END markers, or into a pk3 in the ACS folder. Next, create a lump called LOADACS, and add the filename (minus the file extension), such as "SOMEACS" on its own line. If you wanted multiple entries, they each have to go in their own lines, such as:
It should be that simple. That script should print "Hello World!" on map start, even on stock Doom 2 maps. There are some things to note, however.
- The library name has to be eight characters or less, and each library name must be unique.
- Keep the filename for the ACS and the library name the same. Certain things take filename and certain things like the library name. If both names are the same, there's no problem.
- This only works if the script number isn't already taken. If LoadACS loads a script 100, and the map already has a script 100, it usually uses the map's script, but you shouldn't rely on that.
- "Open-source" ACS is a copy of the ACS scripts that are uncompiled. Even if you think you're done with these scripts, it's helpful to keep around in case you need to edit it later on, or if someone else wants to see how you did things, and it's always helpful to keep in the wad itself.
- If a mod is very ACS-heavy, it's a good idea to keep scripts relatively compartmentalized into different entries in LoadACS. One file for monsters and one file for weapons, for example, can help keep things easy if you want to make a change to one without having to recompile the whole thing.
- If a file called acs.err is created by ACC.exe instead of what you were expecting, there was an error in compiling, and acs.err should help with finding what it is. It opens like a standard .txt. However, it's a lot faster to write and test in Doom Builder, where you would get an error immediately, and compiles with a single button, before you finally compile it with ACC.exe.