Manual for SamShell
for the .NET Framework
Notice: |
Copyright © 2005, Kevin P. Albrecht |
E-mail: |
|
Website: |
|
Version: |
6.00.0020 (14 April 2005) |
BrainScript: |
B5, B6 |
SamShell is the newest version of Sam, the Scriptable Artificial Mind. SamShell loads a predesigned brain file, which the user interacts with by typing. Sam brain files have the extension .brn
On the command line, type the following:
samshell <brain>
To create brain files, the following commands are written, along with other text, into a brain file (*.brn). The brain file is loaded into Sam upon startup. Example brain files are included in the SamShell download, or can be found at the Sam website at http://kevin.alteu.com/.
n>>
Sets the name of the brain; Only set this once.
v>>
Sets the version of the scripting language of the brain; Only set this once.
>>>
Marks a comment
s>>
Matches exact sentence the user types. (Note: not case-sensitive.)
p>>
Matches phrase the user types in a sentence ending in a period, exlamation point, or nothing. (Note: not case-sensitive.)
p?>
Matches phrase the user types in a sentence ending in a question mark. (Note: not case-sensitive.)
e>>
Marks sentences to respond with when no match is found and the user's input ends in a period, exlamation point, or nothing.
e?>
Marks sentences to respond with when no match is found and the user's input ends in a question mark.
r>>
Sentence that brain responds with. If the responding sentence begins with <q>, the rest of the response is displayed, and then the program ends.
<<<
Marks the end of a block of responses (r>>).
<err>
Precedes the text of a r>> command. Causes the program to error out with the given error message.
<sys>
Precedes the text of a r>> command. Executes the program given by the string.
@@#
Located within the text of a r>> command, where # is replaced with an integer from 1 to 9. Replaces the tag with the word from the input corresponding to the # given.
g>>
Sets the initial phrase spoken by the brain upon startup. Only set this once.
The following hints should help users design better BrainScript code for their brain files. If you have more hints, let me know!
When using the phrase command, don’t put any commands that are contained in a second command before the longer command, because the commands match in the order that they are given in the file.
For example, in the following section of a Brain file, an user input of “nobody” will result in a response of “No one is home?”, because the p>> no will match the “no” in “nobody”.
p>> no
r>> Don’t be so negative!
<<<
p>> nobody
r>> No one is home?
<<<