Manual for WinSam
for Windows with the .NET Framework 1.1 (or
higher)
Notice: |
Copyright © 2005, Kevin P. Albrecht |
E-mail: |
|
Website: |
|
Version: |
1.00 (18 April 2005) |
BrainScript: |
B5, B6 |
Environment: |
Windows with the .NET Framework 1.1 (or higher) |
WinSam is the newest version of Sam, the Scriptable Artificial Mind. WinSam loads a predesigned brain file, which the user interacts with by typing. Sam brain files have the extension .brn
In the File menu, select Load Brain to open a .brn file.
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 program 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. There should only be one e>> block.
e?>
Marks sentences to respond with when no match is found and the user's input ends in a question mark. There should only be one e?> block.
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>>
Marks the beginning of a block of responses that display when the brain is started. There should only be one g>> block.
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”.
Example of what not to do:
p>> no
r>> Don’t be so negative!
<<<
p>> nobody
r>> No one is home?
<<<