Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
Tutorial explaining how to use Verb Subscriptions in AdventureJS. tutorial, verb subscriptions

Start Scripting:Verb Subscriptions

To be written...

object_of_verb is a template data structure used by asset.setVerbSubscription() to set individual assets' relationship to specified verbs. Each asset.dov.verb will receive the following properties and default values.

  • name the name of the verb.
  • automatically allows for some verbs to be performed automatically if context calls for it; for example, when unlocking a door in order to pass through it.
  • automatically_after_use if automatically is set true, this sets it so that a verb can only be applied automatically after a player has already used it manually. This is to prevent automatic use of tools from breaking puzzles. For example, imagine one door with many keys but only one that works; if choosing the right key is part of the puzzle, this option prevents players from simply saying "unlock door" and having the right key automatically selected for them.
  • enabled allows changing the state of an asset's responsiveness to a given verb. If set false, a subscribed asset will not respond to the verb. This is useful for temporarily disabling verbs for specific assets; for example, if you had a door that could not be unlocked until another action was completed.
  • doBeforeTry Verb phases provide methods to override default verb behaviors. See Start Scripting: Verb Phases for more information.
  • doAfterTry Verb phases provide methods to override default verb behaviors. See Start Scripting: Verb Phases for more information.
  • doBeforeSuccess Verb phases provide methods to override default verb behaviors. See Start Scripting: Verb Phases for more information.
  • doAfterSuccess Verb phases provide methods to override default verb behaviors. See Start Scripting: Verb Phases for more information.
  • on_success is an optional parameter. It is set as a string by default, but authors may provide a string or array or function to be served by getStringOrArrayOrFunction(). The resulting string will be appended to the verb's default success message.
  • on_first_success is an optional parameter. It is set as a string by default, but authors may provide a string or array or function to be served by getStringOrArrayOrFunction(). The resulting string will be appended to the verb's default success message the first time it is applied to this asset.
  • on_failure is an optional parameter. It is set as a string by default, but authors may provide a string or array or function to be served by getStringOrArrayOrFunction(). The resulting string will be appended to the verb's default failure message.
  • on_first_failure is an optional parameter. It is set as a string by default, but authors may provide a string or array or function to be served by getStringOrArrayOrFunction(). The resulting string will be appended to the verb's default failure message the first time it is applied to this asset.
  • once if true, the verb can only be applied once to the asset. The verb subscription will be disabled after use.
  • then_destroy allows author to specify that this asset should be destroyed after using. If then_destroy is set, the asset will be destroyed after a single use regardless of how once is set. By default, then_destroy is set to a boolean. It may optionally be set to string or array or function subject to getStringOrArrayOrFunction(). If any of those types are found, they will be called and returned as results.
  • with_anything pertains only to indirect objects. If true, this asset can be used as an indirect object of this verb with any direct object.
  • with_classes allows author to specify particular classes that can interact with this asset using the given verb. For example "unlock door with skeleton key" where any instance of the class SkeletonKey can unlock door.
  • with_nothing pertains only to direct objects. If true, the specified verb can be applied to the direct object without the use of any indirect object.
  • with_params is used to contain a set of parameters that are specific to this particular verb. For example, plugIn includes with_params.max_connections for setting limits on how many other assets this asset can be plugged in to.
  • with_prepositions allows author to explicitly permit certain prepositions to be used with a verb on this object. For instance: "knock over umbrella stand" might fail with a message of "you can't knock over the umbrella stand"; setting umbrella_stand.dov.knock.with_prepositions = ["over"] will allow the action to succeed.