Directive

From ZDoom Wiki
Jump to navigation Jump to search

A directive in an ACS command beginning with a hash (or sharp) character (#); in the fashion of the MiniWikipediaLogoIcon.pngC preprocessor directives. Existing directives include:

  • #include <filename>
Includes the content of the given filename. It is generally used to include the common definition file zcommon.acs.
  • #library
Defines the following code as a library. If used, it should be the very first directive, above even #include "zcommon.acs".
  • #import <library name>
Imports a library. This allows to use scripts, functions, and constants defined in the library. Libraries should not be #included!
  • #define <constant name> <value>
This gives a text name to a value, allowing to make the code more readable and easier to update if a same value has to be used in several places. Constant names should only include uppercase letters, numerals, and underscores.
  • #libdefine <constant name> <value>
This is an alternative to #define which is used in libraries. A #libdefined constant can be used by scripts that #import the library that defined it.
  • #nocompact
This directive prevents the compiler from "compacting" or "shrinking" the bytecode where possible. In effect, this forces it to use the ACSE format instead of the ACSe format. It has no effect if compiling in ACS0 format.
  • #wadauthor
Forces the compiler to create a "valid" ACS0 stub (in addition to the ACSe or ACSE bytecode) so that DoomWikiLogoIcon.pngWadAuthor's error checker will not report ACS errors.
  • #nowadauthor
Forces the compiler not to create a valid ACS0 stub. The bytecode will be slightly smaller as a result, but WadAuthor's error checker will mistakenly report that the compiled ACS is broken.
  • #region
  • #endregion
Define the start (#region) and end (#endregion) of a fold-able block of code. This is of use with text editors which support the ability to define code folders such as GZDoom Builder's script editor.