Difference between revisions of "ACS"
From DoomWiki.org
[unchecked revision] | [unchecked revision] |
m (sp) |
(gr; I really think we should leave words like "possibility-opening" to the management consultants; reorganized "programming language"/variable declaration/looping par. and removed 2nd person) |
||
Line 1: | Line 1: | ||
− | '''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 | + | '''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 walls, given that they meet certain criteria (see [[PolyObjects]]). [[Texture]]s displayed on floors and walls can be changed. [[Monster]]s — and any other actors for that matter — can be inserted, removed, monitored, have many of their properties altered, and even pursue "objectives" through a limited form of AI. The use of ACS opens many possibilities for level design, especially if the person using it is talented, patient, and imaginative. |
− | Somewhat more technically | + | Somewhat more technically, a scripting language is a limited form of programming language; its code takes the form of a list of commands to be interpreted by a specific engine. ACS is structured much like C/C++ (it is even commentable, as shown in the example below). A script, which is composed in a text editor of some sort, contains commands, variable declarations, and possibly even calls to other scripts (as with subroutines in a programming languages). The top-level items to recognize are scripts and their script types, which are the events that trigger the sequence of commands contained in a given script. A script is started by typing something such as the following: |
− | |||
<code> | <code> | ||
// This is a comment | // This is a comment | ||
Line 15: | Line 14: | ||
} | } | ||
</code> | </code> | ||
− | |||
− | + | Note that a script is defined somewhat 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. | |
− | -- | + | |
+ | Variables are dimensioned, as in many programming languages. Arrays, or variables in which many values can be stored with an index to differentiate between them (e.g. <tt>ICanMakeArraysLOL[2] = 9</tt>), are valid. A variable intended to be available to all sub-scripts must be declared outside all sub-scripts. | ||
− | + | 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. Looping a script without a delay will cause ZDoom to automatically terminate the script, however, because it won't give anything else in the map a chance to run. When this happens, a message like the following will be generated: | |
− | + | Runaway script 1 terminated | |
− | + | == Source == | |
*{{ZDoom|title=ACS}} | *{{ZDoom|title=ACS}} |
Revision as of 15:25, 18 June 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 walls, given that they meet certain criteria (see PolyObjects). Textures displayed on floors and walls can be changed. Monsters — and any other actors for that matter — can be inserted, removed, monitored, have many of their properties altered, and even pursue "objectives" through a limited form of AI. The use of ACS opens many possibilities for level design, especially if the person using it is talented, patient, and imaginative.
Somewhat more technically, a scripting language is a limited form of programming language; its code takes the form of a list of commands to be interpreted by a specific engine. ACS is structured much like C/C++ (it is even commentable, as shown in the example below). A script, which is composed in a text editor of some sort, contains commands, variable declarations, and possibly even calls to other scripts (as with subroutines in a programming languages). The top-level items to recognize are scripts and their script types, which are 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; } }
Note that a script is defined somewhat 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.
Variables are dimensioned, as in many programming languages. Arrays, or variables in which many values can be stored with an index to differentiate between them (e.g. ICanMakeArraysLOL[2] = 9), are valid. A variable intended to be available to all sub-scripts must be declared outside all sub-scripts.
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. Looping a script without a delay will cause ZDoom to automatically terminate the script, however, because it won't give anything else in the map a chance to run. When this happens, a message like the following will be generated:
Runaway script 1 terminated
Source
- This article incorporates text from the open-content ZDoom documentation project article ACS.