What is RiveScript?

RiveScript is a simple scripting language for giving intelligence to chatbots and other conversational entities.

It's a plain text, line-based scripting language with goals of being simple to learn, quick to type, and easy to read and maintain. This is in contrast to other chatbot languages that require you to read and write ugly XML code (like AIML), or memorize lots of random symbols and "line noise" to write and read your code (like ChatScript).

Let's Meet RiveScript

Without further ado, here is what RiveScript looks like.

RiveScript keeps simple replies simple, for example:

+ hello bot
- Hello, human!
This will add a reply so that when a human says the words "Hello bot", the bot would respond with "Hello, human!"

With more advanced RiveScript code we can learn and repeat user variables and use more complicated trigger matching patterns:

+ my name is *
- <set name=<formal>>I will remember to call you <get name>.

+ (what is|do you know) my name
* <get name> != undefined => Yes, your name is <get name>!
- I don't know your name.
You can learn more in the RiveScript Tutorial.

RiveScript is "Unix-like"

RiveScript is developed using the Unix philosophy that software should do one thing and do it well. RiveScript is not a complete, all-in-one chatbot (although those do exist); instead it is designed to be a self-contained software library with a simple API that can be plugged into any existing codebase.

The RiveScript library only concerns itself with fetching a response to a user input message. Everything else is up to your program. This is in contrast to AIML bots ("Alicebots"), in which an Alicebot is a complete chatbot solution with a configuration system, runtime interface (e.g. support for connecting to instant messengers or listening on a socket server) and all the bells and whistles built in, and which just so happens to include a scripting language (AIML). With AIML bots, it's often difficult to separate out just the code that deals with AIML to use it in your own code. RiveScript's goal is to be simple and self-contained and easy to use it how you want to.

Read more about RiveScript's goals and scope in the Contributing Guidelines.

What Can RiveScript Do?

RiveScript was designed to do everything that AIML can do (you can read about RiveScript's history) and then some, and then some more and more. You can read about RiveScript in comparison to AIML at the RiveScript vs. AIML page, but briefly, here are some of RiveScript's features:
  • Use simplified regular expression style triggers for matching the user's message.
    • Flexible options for trigger matching: wildcards, optional words, alternative words/phrases, arrays, variable matching, and more.
  • Flexible options for responses to a trigger: a direct "1:1" response, random replies (with optional weighting), trigger redirections, internal redirections, and more.
  • Lots of tags for manipulating variables, changing interpreter settings on the fly, formatting text, substituting words, etc.
  • Can process programming code directly inside a RiveScript document, so dynamic replies (for example, search engines) can be integrated directly into RiveScript.

Web design and content copyright © 2024 Noah Petherbridge.