Doom Wiki
(new article)
 
(categorise)
Line 26: Line 26:
 
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.
 
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.
   
*{{ZDoom|title=ACS}}[[Category:Source ports]][[Category:ZDoom]]
+
*{{ZDoom|title=ACS}}
  +
  +
[[Category:Source ports]]
  +
[[Category:ZDoom]]
  +
[[Category:Scripting languages]]

Revision as of 10:18, 10 March 2005

ACS is the scripting language that was created for Hexen 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... ACS is a very possibility-opening scripting implementation, especially if the person using it is talented, patient, and imaginitive.

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++ (it is even commentable, as shown in the example). 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
int AvailableToAllScripts = 101;
int ICanMakeArraysLOL[3] = {3,6,9};

SCRIPT 1 OPEN {
    if (AvailableToAllScripts == 101){
        restart;
    }
}

Please note that looping a script without a delay will cause ZDoom to automatically terminate the script, because it won't give anything else in the map a chance to run. 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 (ICanMakeArraysLOL[2] = 9), are valid.

Note that a script is defined sort of like a function in C, aside from the oddity that it does not have to be terminated after the bracket with a semicolon like all other statements. "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.