Action Code Script

From HandWiki

Action Code Script (ACS) is a scripting language used in video games such as HeXen and some modern Doom source ports, such as ZDoom. It is syntactically similar to C, but less flexible. As its name implies, most of the core logic for script functionality comes in the form of "scripts", which are traditionally identified with a numerical value. Later revisions of the ACS compiler added support for "named" scripts (which utilize a String in lieu of the numerical identifier), and simple functions.

Similar to traditional code, ACS is compiled using ACC (an homage to C's gcc utility) for use in Doom, Hexen, etc... Scripts can be executed in a variety of methods, such as being attached to in-game actors, execution through level triggers around each map, or invocation from other scripts or functions.

As the entire scripting language is built as a hack on top of the Doom id Tech's engine, there is no formal support for any object-oriented programming principles.

"Hello world" example

Using the classic "hello world" example:

// Similar to C's stdio.h, ACS has its own library of basic functions
#include "zcommon.acs"
 
script 1 ENTER
{
    print(s:"Hello World!");
}

In this basic example, the text "Hello World!" is printed upon entering the level. The syntax is as follows:

  • The keyword "script" to indicate its type
  • The print function
  • A string identifier, followed by the string itself

See also

External links