ZScript special words
From ZDoom Wiki
|Note: This feature is for ZScript only.|
ZScript contains special words for certain circumstances.
- Compares a pointer to a class type. Similar to CheckClass with ancestor checks always enabled.
if (mobj is "classname")
- Auto deduces class types to a pointer. If the class is not the specified type, the pointer will be null.
let ptr = DoomImp(target);
- Qualifier for function parameters. Allows passing of a parameter by reference.
- Qualifier for function parameters, but has no purpose aside for documentation. Can be specified with 'out'.
- 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. It is equivalent to a.length() * b.length() * cos(angle), where angle is the angle between the two vectors.
- <Vector2> dot <Vector2>
- <Vector3> dot <Vector3>
- Similar to the dot function but returns a vector. The vector being assigned must be the same type its performing cross multiplication upon. The return value is a new vector that is perpendicular to both of the inputs (unless one of them is a 0 vector, or they are parallel/antiparallel), and therefore it cannot be used on 2D vectors.
- <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;
- Used to reference the world actor currently running ZScript code. Typically implied, but sometimes useful to specify, such as when a variable in a function has the same name as a variable in the class. In such cases, self will refer to the variable in the actor instead of the function when appended with self.
- 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!
- Used to reference the owner of the inventory actor currently running ZScript code.