function setup() {<br>
noCanvas();
let bot = new RiveScript();<br>
//bot.loadFile("brain.rs", brainReady, brainError);<br>
bot.loadFile("brain.rive").then(brainReady).catch(brainError);<br>
function brainReady() {<br>
console.log('Chatbot ready!');<br>
bot.sortReplies();<br>
let num = floor(random(20)) + 1;<br>
console.log(num);<br>
let reply = bot.reply('localhost', 'set ' + num);<br>
}
function brainError() {<br>
console.log('Chatbot error!');<br>
}<br>
let button = select('#submit');<br>
let myInput = select('#myInput');<br>
let output = select('#output');<br>
button.mousePressed(chat);<br>
function chat() {<br>
let input = myInput.value();<br>
let reply = bot.reply("localhost", input);<br>
output.html(reply);<br>
}<br>
}<br>