Denizen API: Difference between revisions
Aufdemrand (talk | contribs) (Created page with "In Denizen, the Script Command system is extensible by design. It's very easy to make your own commands (and soon Requirements) extend the built-in features. On top of that, D...") |
Aufdemrand (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
In Denizen, the Script Command system is extensible by design. It's very easy to make your own commands (and soon Requirements) extend the built-in features. On top of that, Denizen has some features available that may be of use to Plugin Developers. | In Denizen, the Script Command system is extensible by design. It's very easy to make your own commands (and soon Requirements) extend the built-in features. On top of that, Denizen has some features available that may be of use to Plugin Developers. | ||
= Building your own | = Building your own Commands = | ||
=== The ScriptCommand Object === | === The ScriptCommand Object === | ||
When Denizen reads scripts, each line is turned into a SciptCommand object that contains the command, the arguments, and various other data and objects, as described below. Your command is | When Denizen reads scripts, each line is turned into a SciptCommand object that contains the command, the arguments, and various other data and objects, as described below. Your command is an extension of this base Command class, and each time your command is called in for execution, it's this class that is executed and handled a ScriptCommand. How the Command uses the ScriptCommand information is of course, up to you. | ||
==== | ==== What a ScriptCommand holds ==== | ||
ScriptCommands hold data about the situation surrounding the event that activates your command. Which type of script activates your Command, the ScriptCommand can have a multitude of information available. | |||
* <code>.sendingQueue()</code> returns a <code>QueueType</code> of either <code>QueueType.TRIGGER</code>, </code>QueueType.TASK</code>, or <code>QueueType.ACTIVITY</code> | |||
*; This contains the type of queue that sent the command. If the command was issues from a TASK script, for example, this would contain <code>QueueType.TASK</code> | |||
</code> | </code> |
Revision as of 20:37, 5 July 2012
In Denizen, the Script Command system is extensible by design. It's very easy to make your own commands (and soon Requirements) extend the built-in features. On top of that, Denizen has some features available that may be of use to Plugin Developers.
Building your own Commands
The ScriptCommand Object
When Denizen reads scripts, each line is turned into a SciptCommand object that contains the command, the arguments, and various other data and objects, as described below. Your command is an extension of this base Command class, and each time your command is called in for execution, it's this class that is executed and handled a ScriptCommand. How the Command uses the ScriptCommand information is of course, up to you.
What a ScriptCommand holds
ScriptCommands hold data about the situation surrounding the event that activates your command. Which type of script activates your Command, the ScriptCommand can have a multitude of information available.
.sendingQueue()
returns aQueueType
of eitherQueueType.TRIGGER
, QueueType.TASK, orQueueType.ACTIVITY
- This contains the type of queue that sent the command. If the command was issues from a TASK script, for example, this would contain
QueueType.TASK
- This contains the type of queue that sent the command. If the command was issues from a TASK script, for example, this would contain