Usage
Object syntax: this.varname, this.functionname()
Explanation
The this object refers to the current object, depending upon the current context:
- In a normal NPC script, this refers to the NPC object
- Inside a with (obj object) statement, this refers to the object specified
- Inside a class joined to a player, this refers to the current player (like player)
- Inside a class joined to an object, this refers to the object that the class is joined to
The this object is often used for static variable storage inside a database NPC. The "Edit Flags" option in RC when right-clicking a Database NPC lists the currently set this. flags.
Example
function onCreated()
{
this.variable = "magic";
echo("I am " @ this.variable);
}... echoes "I am magic".
Categories
CategoryBuiltInVariable
CategoryVariablePrefix