dao::script::CommandCall
class
One call of a script command, as an intercept receives it.
Arguments are numbered from 0. A vector argument takes three places, so the arguments after it are numbered three higher.
Declared in dao/ScriptHooks.h.
Functions
Command()
int Command() const
Returns the command’s number.
Command()
const ::dao::Command * Command(int n) const
Reads argument n as a command, such as the second argument of AddCommand, or returns null in the same cases as Int.
CommandCall()
CommandCall(int command, int paramCount, int link)
| Parameter | |
|---|---|
command |
the command’s number |
paramCount |
how many arguments the script passed |
link |
this intercept’s position in the command’s chain of intercepts |
Effect()
const CGameEffect * Effect(int n) const
Reads argument n as an effect, or returns null in the same cases as Int.
Event()
const CScriptEvent * Event(int n) const
Reads argument n as an event, or returns null in the same cases as Int.
Float()
std::optional<float> Float(int n) const
Reads argument n as a float, or returns nullopt as Int does.
FloatAnswer()
std::optional<float> FloatAnswer() const
Reads the value as a float, or returns nullopt if it is not one.
Int()
std::optional<std::int32_t> Int(int n) const
Reads argument n where it sits on the script stack, without removing it.
Returns nullopt if the argument has a different type, or there are fewer than n + 1 arguments
IntAnswer()
std::optional<std::int32_t> IntAnswer() const
Reads the value the command left on top of the stack for the script.
Call it after Proceed.
Returns nullopt if that value is not an int
Location()
const CScriptLocation * Location(int n) const
Reads argument n as a location, or returns null in the same cases as Int.
Object()
std::optional<ObjectId> Object(int n) const
Reads argument n as an object, or returns nullopt as Int does.
ObjectAnswer()
std::optional<ObjectId> ObjectAnswer() const
Reads the value as an object, or returns nullopt if it is not one.
ParamCount()
int ParamCount() const
Returns how many arguments the script passed.
Proceed()
int Proceed()
Runs the next handler in the chain: another plugin’s intercept, or the game’s own command.
The handler removes the arguments from the stack. An intercept that answers without calling Proceed must pop the arguments itself (Stack::Pop*) and push its own answer.
Returns the handler’s result, such as kOk
Proceeded()
bool Proceeded() const
Returns whether Proceed has run.
ProceededResult()
int ProceededResult() const
Returns what Proceed returned, once it has run.
SetFloat()
bool SetFloat(int n, float value) const
Changes float argument n, or returns false as SetInt does.
SetFloatAnswer()
bool SetFloatAnswer(float value)
Replaces a float value, or returns false if the value on top is not a float.
SetInt()
bool SetInt(int n, std::int32_t value) const
Changes argument n before the command runs, as if the script had passed the new value.
Later intercepts and the game see the new value.
Returns false if the argument has a different type, there are too few arguments, or Proceed has already run
SetIntAnswer()
bool SetIntAnswer(std::int32_t value)
Replaces the value on top of the stack, so the script gets value.
Call it after Proceed.
Returns false if the value on top is not an int
SetObject()
bool SetObject(int n, ObjectId value) const
Changes object argument n, or returns false as SetInt does.
SetObjectAnswer()
bool SetObjectAnswer(ObjectId value)
Replaces an object value, or returns false if the value on top is not an object.
String()
std::optional<std::wstring_view> String(int n) const
Reads argument n as a string, or returns nullopt as Int does.
The view is valid until the call returns.