Skip to content

Rivescript node

Guidone edited this page Jul 3, 2019 · 3 revisions

Reply to an incoming message using RiveScript.

This node answers with a string to the first output if the script is able to elaborate a reply, otherwise a string error is sent to the second output. This node output is generally connected to a Message Node. The node will not try to parse command-like sentences (for example /my_command).

A RiveScript file looks like

! version = 2.0

+ hello bot
- Hello, human!

It's also able to parse the sentence and store data to the chat context

! version = 2.0

+ my name is guido
- <set name=<star>>ok, I'll remember your name as <get name>

RiveScript can get/set variables in the chat context.

You can use the chat context variable topic to scope some RiveScript triggers into specific subjects

! version = 2.0

> topic name_ok
  + *
  + hello!
< topic

In this case the trigger "*" will be executed only if the topic is name_ok (it's possible to set the intent using a Context node or in RiveScript with {topic=new_topic}). Note that RiveScript's topic and RedBot's intent are the same thing.

Read a RiveScript tutorial tutorial here

Available parameters for the msg.payload

Name Type Description
script string The Rivescript script
scriptFile string Absolute path of Rivescript file
debug boolean Show debug information
Clone this wiki locally