ChatScript is a bot engine with its own programming language. You can find documentation in following link (you probably won't need it as the code in our sample is very intuitive and easy to understand) https://github.com/bwilcox-1234/ChatScript
We need a Python script to convert a ChatScript bot code into a .Flow v2 bot code.
The minimal requeriment is to convert this ChatScript code sample into the provided .Flow v2 sample below:
# Ok
#! I don't like ice cream
u: id000 ( I do not like ice cream ) That's ok. Variable test2 value: $test2
# Name and Likes
u: id100 ( my name is _* and I like _* )
$test = nameandlikes
Your name is '_0 and you like '_1 ... Do you like something else?
# No more likes
# Using reuse function
a: id120 ( ~no ) $test2 = nomorelikes ^reuse(id000)
a: id110 ( _* ) $test2 = '_0 $test3 = "nothing yet" That's great! Variable test value: $test
{
"name": "sample",
"description": "",
"nodes": [
{
"id": "root",
"name": "root",
"description": "Root node",
"context": [
"global"
],
"paths": [
{
"id": "id000",
"name": "id000",
"description": "Ok",
"conditions": {
"$chatscriptMatch": [
"I do not like ice cream",
{
"$input": []
}
]
},
"responses": [
{
"$text": [
"That's ok. Variable test2 value: {test2}"
]
}
],
"exceptions": []
},
{
"id": "id100",
"name": "id100",
"description": "Name and Likes",
"conditions": {
"$chatscriptMatch": [
"my name is _* and I like _*",
{
"$input": []
},
[
"id100var0",
"id100var1"
]
]
},
"responses": [
{
"$store": [
"test",
"nameandlikes"
]
},
{
"$text": [
"Your name is {id100var0} and you like {id100var1} ... do you like something else?"
]
},
{
"$goto": "node1"
}
],
"exceptions": []
}
]
},
{
"id": "node1",
"name": "node1",
"description": "",
"paths": [
{
"id": "id110",
"name": "id110",
"description": "No more likes\nUsing reuse function",
"conditions": {
"$chatscript": [
"~no",
{
"$input": []
}
]
},
"responses": [
{
"$store": [
"test2",
"nomorelikes"
]
},
{
"$gotoResponse": "id000"
}
],
"exceptions": []
},
{
"id": "id120",
"name": "id120",
"description": "",
"conditions": {
"$chatscript": [
"_*",
{
"$input": []
},
[
"id120var0"
]
]
},
"responses": [
{
"$store": [
"test2",
{
"$variable": [
"id120var0"
]
}
]
},
{
"$store": [
"test3",
"nothing yet"
]
},
{
"$text": "That's great! Variable test value {test}"
}
],
"exceptions": []
}
]
}
]
}
ChatScript is a bot engine with its own programming language. You can find documentation in following link (you probably won't need it as the code in our sample is very intuitive and easy to understand) https://github.com/bwilcox-1234/ChatScript
.Flow v2 is also a domain specific language for bot programming with minimal syntax. You can find the specification draft here: https://github.com/SeedVault/flow#documentation
We need a Python script to convert a ChatScript bot code into a .Flow v2 bot code.
The minimal requeriment is to convert this ChatScript code sample into the provided .Flow v2 sample below:
ChatScript code
Resulting .Flow v2 code