zscript-doc/.md

1.3 KiB

Top-level

A ZScript file can have one of several things at the top level of the file:

  • Class definitions
  • Structure definitions
  • Enumeration definitions
  • Constant definitions
  • Include directives

Class definitions

A class definition starts with a class header, followed by an opening brace, class data and a closing brace. Alternatively, you can follow the class header with a semicolon and the rest of the file will be considered class data.

Class headers

The class header is formed as such:

   class Name [: BaseClass] [Class flags...]

Class flags include:

Flag Description
abstract Cannot be instantiated with new().
native Class is from the engine.
ui Has UI scope.
play Has Play scope.
replaces ReplaceClass Replaces ReplaceClass with this class. Only works on objects which are descendants of Actor.
version("ver") Restricted to version .

Example usages:

   class MyCoolObject play // automatically inherits Object
   class MyCoolThinker : Thinker // inherits Thinker
   class MyCoolActor : Actor replaces OtherActor
   class MyCoolInterface abstract // can only be inherited