|
9 | 9 | </head> |
10 | 10 | <body> |
11 | 11 | <h1 id="chatscript-system-functions-manual">ChatScript System Functions Manual</h1> |
12 | | -<p>© Bruce Wilcox, [email protected] www.brilligunderstanding.com <br>Revision 4/ 24/2017 cs7. 4</p> |
| 12 | +<p>© Bruce Wilcox, [email protected] www.brilligunderstanding.com <br>Revision 4/ 30/2017 cs7. 41</p> |
13 | 13 | <ul> |
14 | 14 | <li><a href="ChatScript-System-Functions-Manual.html#topic-functions">Topic Functions</a></li> |
15 | 15 | <li><a href="ChatScript-System-Functions-Manual.html#marking-functions">Marking Functions</a></li> |
@@ -182,6 +182,7 @@ <h3 id="marked-word"><code>^marked ( word )</code></h3> |
182 | 182 | <p>returns <code>1</code> if word is marked, returns <code>FAILRULE_BIT</code> if the given word is not currently marked from the current sentence.</p> |
183 | 183 | <h3 id="setposition-_var-start-end"><code>^setposition ( _var start end )</code></h3> |
184 | 184 | <p>Sets the match location data of a match var to the number values given.</p> |
| 185 | +<p>Alternatively you can do <code>^setposition ( _var _var1 )</code>, which is redundant with just doing <code>_var = _var1</code>.</p> |
185 | 186 | <h3 id="setcanon-wordindex-value"><code>^setcanon ( wordindex value )</code></h3> |
186 | 187 | <p>Changes the canonical value for this word.</p> |
187 | 188 | <h3 id="settag-wordindex-value"><code>^settag ( wordindex value )</code></h3> |
@@ -516,6 +517,8 @@ <h3 id="load-name"><code>^load ( name )</code></h3> |
516 | 517 | <p>You can write script that calls <code>^load</code>, naming the <code>xxx</code> part and they will be dynamically loaded, for that user only, and stay loaded for that user across all volleys until you call <code>^load</code> again. Calling load again with a different name will load that new name. Calling <code>^load(null)</code> will merely unload the dynamic layer previously loaded.</p> |
517 | 518 | <p><strong>WARNING</strong></p> |
518 | 519 | <p>It's erroneous (you get whatever happens to you), if you call <code>^load</code> from within topics you have loaded via <code>^load</code>.</p> |
| 520 | +<h3 id="clearmatch"><code>^clearmatch()</code></h3> |
| 521 | +<p>This clears all match variables to empty.</p> |
519 | 522 | <h3 id="match-what"><code>^match ( what )</code></h3> |
520 | 523 | <p>This does a pattern match using the contents of what (usually a variable reference). It fails if the match against current input fails. It operates on the current analyzed sentence which is usually the current input, but since you can call ^next(input) or <code>^analyze()</code> it is whatever the current analysis data is.</p> |
521 | 524 | <pre><code>if (%more AND ^match(^"(< ![~emocurse ~emothanks] ~interjections >)" ) ) |
@@ -1097,6 +1100,8 @@ <h3 id="sexed-word-he-choice-she-choice-it-choice"><code>^sexed ( word he-choice |
1097 | 1100 | <p>would return <em>she</em></p> |
1098 | 1101 | <h3 id="uppercase-word"><code>^uppercase ( word )</code></h3> |
1099 | 1102 | <p>Is the given word starting with an uppercase letter? Match variable binds usually reflect how the user entered the word. This allows you to see what case they entered it in. Returns 1 if yes and 0 otherwise.</p> |
| 1103 | +<h3 id="format-integerfloat-formatstring-value"><code>^format( integer/float formatstring value)</code></h3> |
| 1104 | +<p>This is a thin wrapper over sprintf. The first argument tells ChatScript what kind of argument you are passing (since everything is a string to ChatScript). The second argument is a string which is the format string for sprintf. The third argument is the number to convert. For floats, you will always be passing a double float so bear that in mind with your formatting. For integer, if you use a %d format, you will be using a 32-bit value. For ll formats you will be using 64-bit but it won't work well on Windows output because Windows uses their own sprintf notation.</p> |
1100 | 1105 | <h3 id="addproperty-word-flag1-flagn"><code>^addproperty ( word flag1 … flagn )</code></h3> |
1101 | 1106 | <p>given the word, the dictionary entry for it is marked with additional properties, the flags given which must match property flags or system flags in <em>dictionarySystem.h</em>. Typically used to mark up titles of books and things when building world data.</p> |
1102 | 1107 | <p>In particular, however, if you are adding phrases or words not in the dictionary which will be used as patterns in match, you should mark them with <code>PATTERN_WORD</code>. To create a dynamic concept, mark the set name as CONCEPT.</p> |
@@ -1144,6 +1149,8 @@ <h3 id="iterator-member-concept"><code>^Iterator ( ? member ~concept )</code></h |
1144 | 1149 | }</code></pre> |
1145 | 1150 | <h3 id="wordatindex-original-canonical-n"><code>^wordAtIndex ( ({original, canonical} n))</code></h3> |
1146 | 1151 | <p><code>^wordAtIndex</code> retrieves the word from the current sentence at the index given, as either the original word or as a canonical word (as a match variable sees it)</p> |
| 1152 | +<p><code>^wordAtIndex ( canonical n n1)</code> gathers a range from n thru n1.</p> |
| 1153 | +<p><code>^wordAtIndex ( original "_0")</code> gathers a range from that which _0 represents (but uses the original data so it is not like merely saying _0, which may not have real data if you did an arbitrary assignment to it setting its position).</p> |
1147 | 1154 | <h1 id="multipurpose-functions">Multipurpose Functions</h1> |
1148 | 1155 | <h3 id="disable-what"><code>^disable ( what ? )</code></h3> |
1149 | 1156 | <p>What can be <code>topic</code> or <code>rule</code> or <code>inputrejoinder</code> or <code>outputrejoinder</code> or <code>save</code> or <code>write @set</code>.</p> |
|
0 commit comments