From ZDoom Wiki
Jump to: navigation, search
For more information on this article, visit the ACS page on the Doom Wiki.

ACS (Action Code Script) is the scripting language that was originally created for Hexen by Raven Software and has been greatly expanded by ZDoom.


ACS enables level makers to script events during gameplay, making creating interactive environments even in Doom's archaic engine infinitely more open-ended. With very basic commands, an author can modify the structure of a level in ways such as raising and lowering floors separately, simultaneously, in the same or opposite directions, and to any height or depth. One can even move certain walls given that they meet certain criteria (see PolyObjects). Textures displayed on floors and walls can be changed. Monsters — and any actors for that matter — can be placed, removed, monitored, have many of their properties altered, have objectives set, etc. ACS is a very possibility-opening scripting implementation, especially if the person using it is talented, patient, and imaginative.

Somewhat more technically defined, a script is something a person writes in a text editor of some sort, that contains individual scripts (kind of like subroutines), commands, variable declarations, and so on. ACS is its very own miniature programming language, structured much like C/C++. The top-level items to recognize are scripts and their script types, which are simply put the events that trigger the sequence of commands contained in a given script. A script is started by typing something such as the following:

// This is a comment
/* This too */
int AvailableToAllScripts = 101;
int ICanMakeArrays[3] = {3,6,9};

Script 1 OPEN {
    int ScriptVariable = 0;
    while(AvailableToAllScripts == 101){

Please note that looping a script without a delay will cause ZDoom to automatically terminate the script, because it would not give anything else in the map a chance to run. This is determined by counting the amount of actions called by the script and terminating if the amount reaches 500,000. Some functions, like distance, can hit this limit when called in a large for loop. You will see a message like the following when this happens:

Runaway script 1 terminated

Variables are dimensioned like in many programming languages. If you want a variable to be available to all scripts, declare/define it outside all scripts. Arrays, or variables by which you can store and refer to many values, differentiating between them by giving an index (ICanMakeArrays[2] = 9) are valid in ZDoom.

Note that a script is defined sort of like a function in C, including the fact that it does not have to be terminated after the bracket with a semicolon like statements inside scripts. "OPEN" as used in this example is a script type that tells ZDoom that the script is to be executed upon starting the level.

Note also that ACS supports conditional statements, and therefore loops made with conditional statements. It supports most (if not all) C/C++ implementations of conditional statements and loops.

ACS needs to be compiled before it can be used in a map. The ACC command-line tool is designed for this purpose.


ACS tutorial

ACS basics

Control structures

Working with ACS