Variable Commands
Store and retrieve player variables that persist across saves and map transfers.Members
- clearVariables
- getVariable
- getVariableKeys
- hasVariable
- removeVariable
- setVariable
- variables
- WithVariableManager
clearVariables
Clear all variables- Source:
packages/server/src/Player/VariableManager.ts - Kind:
method - Defined in:
IVariableManager
Signature
getVariable
Get a variable value- Source:
packages/server/src/Player/VariableManager.ts - Kind:
method - Defined in:
IVariableManager
Signature
Parameters
key:string
Returns
The stored value or undefined if not foundgetVariableKeys
Get all variable keys- Source:
packages/server/src/Player/VariableManager.ts - Kind:
method - Defined in:
IVariableManager
Signature
Returns
Array of all variable keyshasVariable
Check if a variable exists- Source:
packages/server/src/Player/VariableManager.ts - Kind:
method - Defined in:
IVariableManager
Signature
Parameters
key:string
Returns
true if the variable exists, false otherwiseremoveVariable
Remove a variable- Source:
packages/server/src/Player/VariableManager.ts - Kind:
method - Defined in:
IVariableManager
Signature
Parameters
key:string
Returns
true if a variable existed and has been removed, false otherwisesetVariable
Assign a variable to the player. Use player variables for quest flags, per-player event state, and any value that must survive saves and map transitions.- Source:
packages/server/src/Player/VariableManager.ts - Kind:
method - Member of:
VariableManager - Defined in:
IVariableManager
Signature
Parameters
key:stringval:any
variables
Map storing all player variables. These values belong to the player, are persisted, and travel with the player snapshot when switching maps or servers.- Source:
packages/server/src/Player/VariableManager.ts - Kind:
property - Defined in:
IVariableManager
Signature
WithVariableManager
Variable Manager Mixin Provides variable management capabilities to any class. Variables are key-value pairs that can store any type of data associated with the player, such as quest progress, game flags, inventory state, and custom game data. Player variables have two main roles:- Persist player-specific state so it can be restored from saves.
- Carry that state across maps and map servers through the player snapshot.
- Source:
packages/server/src/Player/VariableManager.ts - Kind:
function
Signature
Parameters
Base:TBase