You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -102,14 +101,15 @@ CS just directly embeds the arguments in the string and any attempt to use
102
101
the active string implicitly invokes the equivalent of sprintf.
103
102
104
103
User variables also come in permanent and transient forms.
105
-
<br>**Permanent variables** start with a single `$` and are preserved across user interactions
106
-
(are saved and restored from disk). You can see and alter their value from anywhere.
107
104
108
-
<br>**Transient variables** start with `$$` and completely disappear when a user interaction
109
-
happens (are not saved to disk). You can see and alter their value from anywhere.
105
+
-**Permanent variables**
106
+
start with a single `$` and are preserved across user interactions (are saved and restored from disk). You can see and alter their value from anywhere.
110
107
111
-
<br>**Local variables** (described later) start with `$_` and completely disappear when a user interaction
112
-
happens (are not saved to disk). You can see and alter their value only within the topic or outputmacro they are used.
108
+
-**Transient variables**
109
+
start with `$$` and completely disappear when a user interaction happens (are not saved to disk). You can see and alter their value from anywhere.
110
+
111
+
-**Local variables**
112
+
(described later) start with `$_` and completely disappear when a user interaction happens (are not saved to disk). You can see and alter their value only within the topic or outputmacro they are used.
113
113
114
114
115
115
### Facts
@@ -234,17 +234,16 @@ was this
234
234
```
235
235
^myfunction( $myvar 1)
236
236
```
237
-
then the effect of `^argument1 += 1` is as though `$myvar += 1` were done and `$myvar` would now be one
238
-
higher. Of course, had you tried to do
239
-
`^argument2 += 1` then that would be the illegal `1 += 1` and the assignment would fail.
237
+
then the effect of `^argument1 += 1` is as though `$myvar += 1` were done and `$myvar` would now be one higher.
240
238
239
+
Of course, had you tried to do `^argument2 += 1` then that would be the illegal `1 += 1` and the assignment would fail.
Use of $_ variables in the function definition is a call by value. All $_ variables are purely local and cannot
246
+
Use of `$_` variables in the function definition is a call by value. All `$_` variables are purely local and cannot
248
247
be seen outside of the function (or topic) they are used in. You can also mix call by reference and call by
249
248
value arguments.
250
249
@@ -299,7 +298,8 @@ Concepts can be built from other concepts that do not have specific words.
299
298
Concept: ~myconcept (!thisword ~otherconcept)
300
299
```
301
300
302
-
Note: the system has two kinds of concepts. Enumerated concepts are ones formed from an explicit list of members. Stuff in definitions of concept: ~xxx() are that. There are also internal concepts marked by the system. These include part of speech of a word (requires using the pos-tagger to decide from the input what part of speech it was of possibly several), grammatical roles, words from infinite sets like ~number and ~placenumber and ~weburl, and so forth.
301
+
Note: the system has two kinds of concepts. Enumerated concepts are ones formed from an explicit list of members. Stuff in definitions of `concept: ~xxx()` are that.
302
+
There are also internal concepts marked by the system. These include part of speech of a word (requires using the pos-tagger to decide from the input what part of speech it was of possibly several), grammatical roles, words from infinite sets like `~number` and `~placenumber` and `~weburl`, and so forth.
303
303
304
304
In a pattern of some kind, if you are referencing a sentence location using a match variable, you can match both kinds of concepts. But if you are not tied to a location in a sentence, you can't match internally computed ones. So something like
305
305
```
@@ -323,13 +323,13 @@ When a topic is executing rules, it does not stop just because a rule matches. I
323
323
executing rules until some rule generates ouput for the user or something issues an
324
324
appropriate `^end` or `^fail` call. So you can do things like this:
325
325
```
326
-
u: (I love) $userloves = true
326
+
u: (I love) $userloves = true
327
327
328
328
u: ( dog ) $animal = dog
329
329
330
-
u: ( love) Glad to hear it
330
+
u: ( love) Glad to hear it
331
331
332
-
u: ( dog) I hate dogs
332
+
u: ( dog) I hate dogs
333
333
```
334
334
and given _I love dogs_, the system will set $userloves and $animal and output glad to
335
335
hear it.
@@ -344,27 +344,27 @@ topic: ~rust keep random [rust iron oxide]
|`Random` | search rules randomly instead of linearly
350
-
|`NoRandom` | (default) search rules linearly
351
-
|`Keep` | do not erase responders ever. Gambits (and rejoinders) are not affected by this
352
-
|`Erase` | (default) erase responders that successfully generate output.<br>Gambits automatically erase unless you suppress them specifically.
353
-
|`NoStay` | do not consider this a topic to remain in, leave it (except for rejoinders)
354
-
|`Stay` | (default) make this a pending topic when it generates output
355
-
|`Repeat` | allow rules to generate output which has been output recently
356
-
|`NoRepeat` | (default) do not generate output if it matches output made recently
357
-
|`Priority` | raise the priority of this topic when matching keywords
358
-
|`Normal` | (default) give this topic normal priority when matching keywords
359
-
|`Deprioritize`| lower the priority of this topic when matching keywords
360
-
|`System` | this is a system topic. It is automatically `NoStay`, `Keep`.<br>`Keep` automatically applies to gambits as well. The system never looks to these topics for gambits. System topics can never be considered pending (defined shortly). They can not have themselves or their rules be enabled or disabled. Their status/data is never saved to user files.
361
-
|`User` | (default) this is a normal topic
362
-
|`NoBlocking` | should not perform any blocking tests on this topic in `:verify`
363
-
|`NoPatterns` | should not perform any pattern tests on this topic in `:verify`
364
-
|`NoSamples` | should not perform any sample tests on this topic in `:verify`
365
-
|`NoKeys` | should not perform any keyword tests on this topic in `:verify`
366
-
|`More` | normally if you try to redeclare a concept, you get an error. `MORE` tells CS you intend to extend the concept and allows additional keywords.
367
-
|`Bot=name` | if this is given, only named bots are allowed to use this topic. See `ChatScript Multiple Bots manual`
347
+
|flag | description
348
+
|:----------------:|--------------
349
+
|__`random`__ | search rules randomly instead of linearly
350
+
|__`norandom`__ | (default) search rules linearly
351
+
|__`keep`__ | do not erase responders ever. Gambits (and rejoinders) are not affected by this
352
+
|__`erase`__ | (default) erase responders that successfully generate output.<br>Gambits automatically erase unless you suppress them specifically.
353
+
|__`nostay`__ | do not consider this a topic to remain in, leave it (except for rejoinders)
354
+
|__`stay`__ | (default) make this a pending topic when it generates output
355
+
|__`repeat`__ | allow rules to generate output which has been output recently
356
+
|__`norepeat`__ | (default) do not generate output if it matches output made recently
357
+
|__`priority`__ | raise the priority of this topic when matching keywords
358
+
|__`normal`__ | (default) give this topic normal priority when matching keywords
359
+
|__`deprioritize`__| lower the priority of this topic when matching keywords
360
+
|__`system`__ | this is a system topic. It is automatically `nostay`, `keep`.<br>`keep` automatically applies to gambits as well. The system never looks to these topics for gambits. System topics can never be considered pending (defined shortly). They can not have themselves or their rules be enabled or disabled. Their status/data is never saved to user files.
361
+
|__`user`__ | (default) this is a normal topic
362
+
|__`noblocking`__ | should not perform any blocking tests on this topic in `:verify`
363
+
|__`nopatterns`__ | should not perform any pattern tests on this topic in `:verify`
364
+
|__`nosamples`__ | should not perform any sample tests on this topic in `:verify`
365
+
|__`nokeys`__ | should not perform any keyword tests on this topic in `:verify`
366
+
|__`more`__ | normally if you try to redeclare a concept, you get an error. `more` tells CS you intend to extend the concept and allows additional keywords.
367
+
|__`bot=name`__ | if this is given, only named bots are allowed to use this topic. See [ChatScript Multiple Bots](ChatScript-Multiple-Bots.md) manual.
368
368
369
369
370
370
## Rules that erase and repeat
@@ -934,7 +934,7 @@ the `_` equivalent) is a single item, whereas ( take charge) is 4 items.
934
934
935
935
So the first rule will below will match faster than the second rule:
936
936
```
937
-
u: ("I love you today when")
937
+
u: ("I love you today when")
938
938
939
939
u: (I love you today when)
940
940
```
@@ -1552,7 +1552,7 @@ early termination effects.
1552
1552
# System Functions
1553
1553
1554
1554
There are many system functions to perform specific tasks. These are enumerated in the
1555
-
[ChatScript System Functions Manual](ChatScript-System-Functions-Manual.md)manual and the [ChatScript Fact Manual](ChatScript-Fact-Manual.md) manual.
1555
+
[ChatScript System Functions Manual](ChatScript-System-Functions-Manual.md) and the [ChatScript Fact Manual](ChatScript-Fact-Manual.md).
1556
1556
1557
1557
1558
1558
## Randomized Output Revisited `[ ]`
@@ -1796,22 +1796,14 @@ and have the system automatically generate gestures during postprocessing on its
1796
1796
The stand-alone engine and the WEBINTERFACE/BETTER scripts automatically handle
1797
1797
the following oob outputs:
1798
1798
1799
-
**Callback**: The webpage or stand-alone engine will wait for the designated milliseconds
1800
-
and if the user has not begun typing will send in the oob message [callback] to CS. If user
1801
-
begins typing before the timeout, the callback is cancelled.
1802
-
e.g. `[callback=3000]` will wait 3 seconds.
1799
+
-**Callback**
1800
+
The webpage or stand-alone engine will wait for the designated milliseconds and if the user has not begun typing will send in the oob message [callback] to CS. If user begins typing before the timeout, the callback is cancelled. e.g. `[callback=3000]` will wait 3 seconds.
1803
1801
1804
-
**Loopback**: The webpage or stand-alone engine will wait for the designated milliseconds
1805
-
after every output from CS and if the user has not begun typing will send in the oob
1806
-
message [loopback] to CS. If user begins typing before the timeout, the loopback is
1807
-
cancelled for this output only, and will resume counting on the next output.
1808
-
e.g. `[loopback=3000]` will wait 3 seconds after every output.
1802
+
-**Loopback**
1803
+
The webpage or stand-alone engine will wait for the designated milliseconds after every output from CS and if the user has not begun typing will send in the oob message [loopback] to CS. If user begins typing before the timeout, the loopback is cancelled for this output only, and will resume counting on the next output. e.g. `[loopback=3000]` will wait 3 seconds after every output.
1809
1804
1810
-
**Alarm**: The webpage or stand-alone engine will wait for the designated milliseconds and
1811
-
then send in the oob message [alarm] to CS. Input typing has no effect.
1812
-
e.g. `[alarm=3000]` will wait 3 seconds and then send in the alarm.
1813
-
CS can cancel any of these by sending an oob message with a milliseconds of 0.
1814
-
e.g. `[loopback=0 callback=0 alarm=0]` cancels any pending callbacks into the future.
1805
+
-**Alarm**
1806
+
The webpage or stand-alone engine will wait for the designated milliseconds and then send in the oob message [alarm] to CS. Input typing has no effect. e.g. `[alarm=3000]` will wait 3 seconds and then send in the alarm. CS can cancel any of these by sending an oob message with a milliseconds of 0. e.g. `[loopback=0 callback=0 alarm=0]` cancels any pending callbacks into the future.
1815
1807
1816
1808
1817
1809
# System callback functions
@@ -2003,7 +1995,7 @@ $tmp = ##first
2003
1995
2004
1996
## Defining private Queries
2005
1997
2006
-
see [ChatScript Fact Manual](ChatScript-Fact-Manual.md) manual.
1998
+
see [ChatScript Fact Manual](ChatScript-Fact-Manual.md).
2007
1999
2008
2000
2009
2001
## Documenting variables, functions, factsets, and match variables
@@ -2091,7 +2083,7 @@ Normally lower case words would break up a title.
2091
2083
2092
2084
# Common Script Idioms
2093
2085
2094
-
## Selecting Specific Cases ^refine
2086
+
## Selecting Specific Cases `^refine`
2095
2087
2096
2088
To be efficient in rule processing, I often catch a lot of things in a rule and then refine it.
0 commit comments