Skip to content

Commit 64cff65

Browse files
committed
CS7.31
1 parent 0ffe88b commit 64cff65

File tree

135 files changed

+2633
-2345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+2633
-2345
lines changed

BINARIES/ChatScriptmongo.exe

4.66 MB
Binary file not shown.

BINARIES/LinuxChatScript64

12.3 KB
Binary file not shown.

BINARIES/chatscript.exe

2 KB
Binary file not shown.

BINARIES/chatscriptpg.exe

21.5 KB
Binary file not shown.

BINARIES/libbson-1.0.dll

259 KB
Binary file not shown.

BINARIES/libmongoc-1.0.dll

536 KB
Binary file not shown.

HTMLDOCUMENTATION/ChatScript-Advanced-User-Manual.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</head>
1010
<body>
1111
<h1 id="chatscript-advanced-users-manual">ChatScript Advanced User's Manual</h1>
12-
<p>© Bruce Wilcox, [email protected] www.brilligunderstanding.com <br>Revision 2/09/2017 cs7.2 <br><br></p>
12+
<p>© Bruce Wilcox, mailto:[email protected] www.brilligunderstanding.com <br>Revision 4/8/2017 cs7.31 <br><br></p>
1313
<ul>
1414
<li><a href="ChatScript-Advanced-User-Manual.html#review-overview-of-how-cs-works">Review</a></li>
1515
<li><a href="ChatScript-Advanced-User-Manual.html#advanced-concepts">Advanced Concepts</a></li>
@@ -120,6 +120,7 @@ <h1 id="advanced-concepts">ADVANCED CONCEPTS</h1>
120120
<p>will fail. Even</p>
121121
<pre><code>if (pattern practical?~adjective)</code></pre>
122122
<p>will fail given that deciding practical is an adjective (it could also be a noun) hasn't been performed by pos-tagging.</p>
123+
<p>All internal concepts are members of the concept <code>~internal_concepts</code>.</p>
123124
<h1 id="advanced-topics">ADVANCED TOPICS</h1>
124125
<p>There are several things to know about advanced topics.</p>
125126
<h2 id="topic-execution">Topic Execution</h2>
@@ -455,6 +456,7 @@ <h2 id="precautionary-note-about-and-pattern-matching-retries">Precautionary not
455456
<p>The system is allowed to backtrack and see if the first match can be made later. So it will try to find the later than position one. It would succeed in relocating it to position 4. It would then try to find the word bear afterwards, and succeed at position 5. It would then try to find the word ate after that and fail. It would retry trying to reset the pattern to find the after position 4 and fail. The match fails.</p>
456457
<p>You can fix this ordering problem by making a concept set of the contents of the <code>[ ]</code>, and replacing the <code>[ ]</code> with the name of the concept set. A concept set being matched in a pattern will always find the earliest matching word. The number of elements in a concept set is immaterial both to the order of finding things and to the speed of matching.</p>
457458
<h1 id="advanced-output">ADVANCED OUTPUT</h1>
459+
<h2 id="committed-output">Committed Output</h2>
458460
<p>Simple output puts words into the output stream, a magical place that queues up each word you write in a rule output. What I didn't tell you before was that if the rule fails along the way, an incomplete stream is canceled and says nothing to the user. For example,</p>
459461
<pre><code>t: I love this rule. ^fail(RULE)</code></pre>
460462
<p>Processing the above gambits successively puts the words <em>I</em>, <em>love</em>, <em>this</em>, <em>rule</em>, <em>.</em> into the output stream of that rule.</p>
@@ -463,9 +465,19 @@ <h1 id="advanced-output">ADVANCED OUTPUT</h1>
463465
<p>I also didn't tell you that the system monitors what it says, and won't repeat itself (even if from a different rule) within the last 20 outputs. So if, when converting the output stream into a response to go in the responses list, the system finds it already had such a response sent to the user in some recently earlier volley, the output is also discarded and the rule &quot;fails&quot;.</p>
464466
<p>Actually, it's a bit more complicated than that. Let's imagine a stream is being built up. And then suddenly the rule calls another rule (<code>^reuse</code>, <code>^gambit</code>, <code>^repond</code>). What happens? E.g.</p>
465467
<pre><code>u: (some test) I like fruit and vegetables. ^reuse(COMMON) And so do you.</code></pre>
466-
<p>What happens is this- when the system detects the transfer of control (the <code>^reuse</code> call), if there is output pending it is finished off and packaged for the user. The current stream is cleared, and the rule is erased (if allowed to be). Then the <code>^reuse()</code> happens. Even if it fails, this rule has produced output and been erased.</p>
468+
<p>What happens is this- when the system detects the transfer of control (the <code>^reuse</code> call), if there is output pending it is finished off (committed) and packaged for the user. The current stream is cleared, and the rule is erased (if allowed to be). Then the <code>^reuse()</code> happens. Even if it fails, this rule has produced output and been erased.</p>
467469
<p>Assuming the reuse doesn't fail, it will have sent whatever it wants into the stream and been packaged up for the user. The rest of the message for this rule now goes into the output stream <em>and so do you</em> and then that too is finished off and packaged for the user. The rule is erased because it has output in the stream when it ends (but it was already erased so it doesn't matter).</p>
468470
<p>So, output does two things. It queues up tokens to send to the user, which may be discarded if the rule ultimately fails. And it can call out to various functions. Things those functions may do are permanent, not undone if the rule later fails.</p>
471+
<p>There is a system variable <code>%response</code> which will tell you the number of committed responses. Some code (like Harry's control script) do something like this:</p>
472+
<pre><code>$_response = %response
473+
...
474+
if ($_response == %response) {...}</code></pre>
475+
<p>which is intented to mean if no response has been generated so far, try the code in the ^if. But you have to be wary of the pending buffer. Calling some code, even if it fails, may commit the pending buffer. If there is a chance you will have pending output, the correct and safe way to code this is:</p>
476+
<pre><code>^flushoutput()
477+
$_response = %response
478+
...
479+
if ($_response == %response) {...}</code></pre>
480+
<p>^flushoutput will commit pending output.</p>
469481
<h2 id="output-cannot-have-rules-in-it">Output cannot have rules in it</h2>
470482
<p>Output script cannot emed another rule inside it. Output is executed during the current volley whereas rules (like rejoinder rules) may be executed in a different volley. Therefore this is illegal:</p>
471483
<pre><code>u: GREETING (~emohello)
@@ -767,6 +779,8 @@ <h1 id="out-of-band-communication">Out of band Communication</h1>
767779
<h1 id="system-callback-functions">System callback functions</h1>
768780
<pre><code>outputmacro: ^CSBOOT()</code></pre>
769781
<p>This function, if defined by you, will be executed on startup of the ChatScript system. It is a way to dynamically add facts and user variables into the base system common to all users. And returned output will go to the console and if a server, into the server log Note that when a user alters a system <code>$variable</code>, it will be refreshed back to its original value for each user.</p>
782+
<pre><code>outputmacro: ^CS_REBOOT()</code></pre>
783+
<p>This function, if defined by you, will be executed on every volley prior to loading user data. It is executed as a user-level program which means when it has completed all newly created facts and Variables just disappear. It is used in conjunction with a call to the system function ^reboot() to replace data from a ^CSBOOT. Typically you would have the <code>^CS_REBOOT</code> function test some condition (results of a version stamp) and if the version currently loaded in the boot layer is current, it simply returns having done nothing. If the boot layer is not current, then you call ^REBOOT() which erases the current boot data and treats the remainder of the script as refilling the boot layer with new facts and variables.</p>
770784
<pre><code>outputmacro: ^CSSHUTDOWN()</code></pre>
771785
<p>This function, if defined by you, will be executed on shutdown or restart of the ChatScript system.</p>
772786
<pre><code>outputmacro: ^cs_topic_enter(^topic ^mode)</code></pre>

HTMLDOCUMENTATION/ChatScript-Basic-User-Manual.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</head>
1010
<body>
1111
<h1 id="chatscript-basic-user-manual">ChatScript Basic User Manual</h1>
12-
<p>© Bruce Wilcox, [email protected] brilligunderstanding.com <br>Revision 2/09/2017 cs7.2 <br></p>
12+
<p>© Bruce Wilcox, mailto:[email protected] www.brilligunderstanding.com <br>Revision 4/8/2017 cs7.31</p>
1313
<ul>
1414
<li><a href="ChatScript-Basic-User-Manual.html#overview">Overview</a></li>
1515
<li><a href="ChatScript-Basic-User-Manual.html#simple-topics">Simple Topics</a></li>
@@ -45,7 +45,7 @@ <h2 id="comments">Comments</h2>
4545
<pre><code>s: (I hate meat) So do I. # an untruth</code></pre>
4646
<p>There are special documentation comments that start with <code>#!</code> described elsewhere.</p>
4747
<h2 id="legal-declaration-names">Legal declaration names</h2>
48-
<p>A topic or function must contain only alpha-numeric characters, underscores, hyphens, and periods. They must begin with <code>~</code> and then continue with a starting alphabetic character. Variables must start with <code>$</code> or <code>$$</code>, then begin with a starting alphabetic character and continue with alpha-numerics, underscores, or hyphens.</p>
48+
<p>A topic or function must contain only alpha-numeric characters, underscores, hyphens, and periods. They must begin with <code>~</code> and then continue with a starting alphabetic character. Variables must start with <code>$</code> or <code>$$</code> or <code>$_</code>, then continue with a starting alphabetic character and then continue with alpha-numerics, underscores, or hyphens.</p>
4949
<h1 id="hello-word-demo">Hello Word Demo</h1>
5050
<p>Let’s turn to running the system in a simple demo.</p>
5151
<ul>

0 commit comments

Comments
 (0)