KB122: Using the Character Server with ChatScript

The ChatScript AI engine is one of the most advanced chat engines available today. While it is not for beginners, the engine is particularly suited for building chatbots that are proactive in advancing a specific agenda or playing a specific role in a training scenario.

Step 1. Install the ChatScript server

ChatScript is available as a public domain server. You can download the latest from here. We have tested with versions 4.6 through 6.1. We recommend unzipping this file into a directory C:\Program Files (x86)\Character Server\ChatScript.

Step 2. Set ChatScript to run on startup (optional)

You can run the ChatScript server from a command line by changing to this directory and running "ChatScript.exe port=1024". It is important that you launch the server with the directory in which it is located as the current directory.

ChatScript is not a service, however it can be configured to run on startup, even when no user is logged in, using the Task Scheduler. To do this, create a new task named ChatScript. On the General page, ensure the "Run whether user is logged in or not" and note that you will NOT see a window for this task when you ARE logged in, but you will see the chatscript process listed in the Performance Monitor under Background Tasks. For the Action, you will "Start a program" - select the chatscript.exe file, provide the port argument, and enter the "Start in" directory to be the same as that in which the ChatScript.exe file is located. Do NOT use quotes in the "Start in" field. Select "At startup" as a Trigger. Finally, on the Setting tab, you do NOT want the option to kill the process if it runs for 3 days. You can now start the server manually - it will continue running when you log off, and automatically start when the server reboots.

Step 3. Understand how to build a new bot

As described in the ChatScript documentation, your bot's source files are in a directory called RAWDATA. The program comes with a simple bot named Harry. You can start a second instance of ChatScript on the server, from a command line, running out of the same directory, but without the port=1024 argument. This will let you interactively test your bot(s) and refine their rules. For example you might change the file RAWDATA\HARRY\childhood.top, then issue ":build harry reset" from the ChatScript command line to test your changes. The ":build" command will rebuild the files in the TOPIC directory. To make your changes live, you can simply stop and restart the production ChatScript task, from the Task Scheduler, as this will cause it to re-read the same TOPIC files.

Step 4. Start the ChatScript adapter

With Character Server 5.4.2 or higher installed, right click on My Computer, open Services, locate Media Semantics ChatScript Adapter, and start the service. You may want to set it to start automatically.

Step 5. Create your CB project

Use the "AI Project" template in the New Project wizard. An AI project is conceptually just like a Dynamic Speech project, except that instead of passing the text to be spoken by the bot, you are passing the text that the user typed in. With the right parameters, the Character Server will know to first translate the input to an output using ChatScript, and then speak that output. Click on the message "Respond" in Outline view, then in the Properties tab below, click the Build... button.

Be sure the Generate an AI response checkbox is turned on and ChatScript is selected.




Copyright © 2016 Media Semantics, Inc. All rights reserved.
Comments? Write webmaster@mediasemantics.com. See also our privacy policy.

Image 01