Adventure.js Docs Downloads
Score: 0 Moves: 0
Tutorial explaining the anatomy of a verb in Adventurejs. tutorial, verb anatomy

How to:Anatomy of a Verb

Adventurejs's verbs fall into a small number of patterns. There are direction verbs, which are fairly simple and quickly punt to a global tryTravel() method. The bulk of verbs have to do with physical manipulation. (Well, "physical" manipulation. Since of course it's all virtual.) For example, lock, unlock, hit, write, and jump are just a few common physical manipulation verbs. Most of these verbs' code structures will look something like the diagram below. The examples shown below don't represent any particular verb, as details will vary per verb. Some of the blocks shown below may exist in some verbs but not others, and some of the function calls may or may not be used by any verb. But hopefully this will offer some idea of how a verb is constructed.

  • String properties: name, prettyname, state, past_tense, etc
  • phrase3
    Phrases work with structures to help the parser exclude input that the verb can't handle, before it reaches the verb. The majority of verbs have only one or two phrases. Some verbs may have three. For example, attach pipe to flange with wrench would take three phrases, one for each noun in the input. Phrases can help the parser determine whether the verb accepts or requires a preposition, what that preposition must be, and what conditions must be true for any noun that the verb refers to.
Documentation generated by JSDoc 3.6.11 on Mon Nov 20 2023 18:04:50 GMT-0800 (Pacific Standard Time)
Found a problem or error in the docs? Report it to