Add Verbs and Actions
[inform-resources.git] / informqr / informqr.md
index 9e3f72d7f641b03eb5f1bbd52536376707d83a04..490805c78ad3b363cad486536ac0a46135c637e5 100644 (file)
@@ -79,10 +79,10 @@ list of alternatives *q1* `or` *q2* `or` ... *qN*:
   ---------------- ----------------------------------------
   *p == q*         *p* is equal to *q*
   *p ~= q*         *p* isn't equal to *q*
-  *p* > *q*     *p* is greater than *q*
-  *p < q*       *p* is less than *q*
-  *p >= q*      *p* is greater than or equal to *q*
-  *p <= q*      *p* is less than or equal to *q*
+  *p* > *q*     *p* is greater than *q*
+  *p < q*       *p* is less than *q*
+  *p >= q*      *p* is greater than or equal to *q*
+  *p <= q*      *p* is less than or equal to *q*
   *p ofclass q*    object *p* is of class *q*
   *p in q*         object *p* is a child of object *q*
   *p notin q*      object *p* isn't a child of object *q*
@@ -148,22 +148,22 @@ A **word array** is a set of global words accessed using `array-->0`,
     Array array --> "string";
 
 A **table array** is a set of global words accessed using
-*array--&gt;1*, *array--&gt;2*, ... *array--&gt;N*, with
-*array--&gt;0* initialized to *N*:
+*array-->1*, *array-->2*, ... *array-->N*, with
+*array-->0* initialized to *N*:
 
     Array array table N ;
     Array array table expr1 expr2 ... exprN 
     Array array table "string";
 
 A **byte array** is a set of global bytes accessed using
-*array-&gt;0*, *array-&gt;1*, ... *array-&gt;(N-1)*:
+*array->0*, *array->1*, ... *array->(N-1)*:
 
     Array array -> N;
     Array array -> expr1 expr2 ... exprN;
     Array array -> "string";
 
 A **string array** is a set of global bytes accessed using
-*array-&gt;1*, *array-&gt;2*, ... *array-&gt;N*, with *array-&gt;0*
+*array->1*, *array->2*, ... *array->N*, with *array->0*
 initialized to *N*:
 
     Array array string N;
@@ -520,4 +520,61 @@ To assign to one of 32 'low string' variables:
 
     string N "string";
     Lowstring string_var "string";
-    string N string_var;
\ No newline at end of file
+    string N string_var;
+
+Verbs and Actions
+-----------------
+
+To specify a new verb:
+
+    Verb 'verb ' 'verb ' ... 'verb '
+         * token token ... token -> action
+         * token token ... token -> action
+         ...
+         * token token ... token -> action;
+
+where instead "`Verb`" can be "`Verb meta`", "*action*" can be
+"`action reverse`"; *tokens* are optional and each is one of:
+
+  ----------------- ----------------------------------------------
+  'word'            that literal word
+  'w1'/'w2'/...     any one of those literal words
+  attribute         an object with that attribute
+  creature          an object with `animate` attribute
+  held              an object held by the player
+  noun              an object in scope
+  noun=`routine`    an object for which *routine* returns `true`
+  scope=`routine`   an object in this re-definition of scope
+  multiheld         one or more objects held by the player
+  multi             one or more objects in scope
+  multiexcept       as multi, omitting the specified object
+  multiinside       as multi, omitting those in specified object
+  topic             any text
+  number            any number
+  routine           a general parsing routine
+  ----------------- ----------------------------------------------
+
+To add synonyms to an existing verb:
+
+    Verb 'verb ' 'verb ' ... = 'existing_verb';
+
+To modify an existing verb:
+
+    Extend 'existing_verb ' last
+         * token token ... token –> action
+         * token token ... token –> action
+         ...
+         * token token ... token –> action ;
+
+where instead "`Extend`" can be "`Extend only`" and "`last`" can be
+omitted, or changed to "`first`" or "`replace`"
+
+To explicitly trigger a defined action (both *noun* and *second* are
+optional, depending on the action):
+
+    <action noun second>;
+
+To explicitly trigger a defined action, then return `true` from the
+current routine:
+
+    <<action noun second >>;
\ No newline at end of file