ZScript special words

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

ZScript contains special words for certain circumstances.

  • is
    Compares a pointer to a class type. Similar to CheckClass with ancestor checks always enabled.
if (mobj is "classname")
  • let
    Auto deduces class types to a pointer. If the class is not the specified type, the pointer will be null.
let ptr = DoomImp(target);
  • out
    Qualifier for function parameters. Allows passing of a parameter by reference.
  • in
    Qualifier for function parameters, but has no purpose aside for documentation. Can be specified with 'out'.
  • dot
    Serves as an operator that results in a double. The syntax can take either a Vector2 or Vector3, but they must be the same on both sides.
<Vector2> dot <Vector2>
<Vector3> dot <Vector3>
  • cross
    Similar to the dot function but returns a vector. The vector being assigned must be the same type its performing cross multiplication upon.
<Vector2> = <Vector2> cross <Vector2>
<Vector3> = <Vector3> cross <Vector3>
Vector3 a = (1, 2, 3);
Vector3 b = (3, 2, 1);
double dot_prod = a dot b;
Vector3 cross_prod = a cross b;
  • self
    Used to reference the world actor currently running ZScript code. Typically implied, but sometimes useful to specify.
  • invoker
    Used to reference the inventory actor currently running ZScript code. Note that this includes player weapons. It is necessary to prefix an inventory items' local variable references or methods with invoker!
  • owner
    Used to reference the owner of the inventory actor currently running ZScript code.
  • master
    Used to access an actor's master pointer. See actor pointers for default engine use cases.
  • target
    Used to access an actor's target pointer. See actor pointers for default engine use cases.
  • tracer
    Used to access an actor's tracer pointer. See actor pointers for default engine use cases.

See also