From ZDoom Wiki
Jump to: navigation, search
Note: This feature is for ZScript only.

ZScript (formerly known as DoomScript) is a text-format lump used to create classes or structs for use in ZDoom. The base zscript.txt is known as a translation unit. It can include the names of other lumps for processing similar to DECORATE.

#include "ZScript/Player.txt"

Note: Due to how ZScript is processed, it is possible to name a file which conflicts with other mods or the internal files. I.e. ZScript/Const.txt will prevent the game loading as this file is already defined internally. To avoid such conflicts, it is recommended to have another subfolder or have the ZScript folder name changed:

#include "ZScript/MyMod/Player.txt"
#include "ZMyMod/Player.txt"

Currently, ZScript is set to not load with the start-up of ZDoom. To enable it, the game must be run with -zscript in the command line parameters.

However, as of GZDoom 2.3.0, ZScript is enabled by default and does not require the parameter.

Combining ZScript and DECORATE

It is perfectly possible to use both DECORATE and ZScript simultaneously. For example, ZScript might be used to create some custom action function, which are then available normally to DECORATE actors. The ZScript code is processed and compiled before the DECORATE code; this means that DECORATE actors can inherit from ZScript actors, but not vice-versa. For references that are only needed at run-time, rather than compile-time (such as calling a function to spawn an actor), then there is no restriction: a ZScript actor can spawn a DECORATE actor, or vice-versa.

ZScript topics