Doom Wiki
(new article)
 
Wagnike2 (talk | contribs)
No edit summary
 
(22 intermediate revisions by 14 users not shown)
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 certain walls given that they meet certain criteria (see [[PolyObjects]]). [[Texture]]s displayed on floors and walls can be changed. [[Monster]]s -- 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.
+
'''Action Code Script''' ('''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 the creation of 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 use move walls, given that they meet certain criteria (see [[Polyobject]]). [[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 [[Wikipedia:Artificial intelligence|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 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:
+
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>// This is a comment
-----
 
<code>
 
// This is a comment
 
 
int AvailableToAllScripts = 101;
 
int AvailableToAllScripts = 101;
 
int ICanMakeArraysLOL[3] = {3,6,9};
 
int ICanMakeArraysLOL[3] = {3,6,9};
 
 
 
SCRIPT 1 OPEN {
 
SCRIPT 1 OPEN {
if (AvailableToAllScripts == 101){
+
if (AvailableToAllScripts == 101){
restart;
+
restart;
}
 
 
}
 
}
  +
}
</code>
 
 
</code>
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:
 
   
 
Note that a script is defined somewhat like a function in C. "OPEN", as used in this example, is a script type that tells ZDoom that the script is to be executed upon starting the level.
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.
+
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
   
  +
== Sources ==
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.
 
   
  +
*{{ZDoom|title=ACS}}
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.
 
   
  +
<!--Interwiki links-->
*{{ZDoom|title=ACS}}[[Category:Source ports]][[Category:ZDoom]]
 
  +
[[es:Action code script (ACS)]]
  +
[[Category:ZDoom]]
  +
[[Category:Scripting languages]]
  +
[[Category:Hexen]]

Latest revision as of 15:12, 16 March 2020

Action Code Script (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 the creation of 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 use move walls, given that they meet certain criteria (see Polyobject). 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. "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

Sources