AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Multiple responses to statement

Hi Everyone
I want to make my chatbot be versatile, and be able to respond to completely random stuff.

t: Do you guys want to play a game
a: (~yes) awesome
a: (~no) why not
    a: (~list of phrases) respond with correct phrase
        b: (because *) That isn’t a good answer
a: (*) lets still play anyway

(~list of phrases) respond with correct phrase
So my list of random phrases can be like
u: (you are stupid) that is mean
u: (who is the president) Donald Trump
u:(what is your name) I told you my name, it is Harry

Anyone know how to do this?

Thank you


  [ # 1 ]

Hi Tashi

if i well understood,

you can invoke in you main topic, a second dedicated topic with


containing all your “random stuff”:

topic: ~list_of_phrases []

: (you are stupidthat is mean
(who is the presidentDonald Trump
u:(what is your name
I told you my nameit is Harry 

BTW, there is no need to respond if you exploit the natural CS behaviour of automatic topic invocation, assigning keywords to topic

See how Harry demo bot manage quibbles topic…

topic: ~list_of_phrases ["Donald Trump" stupidity president etcetc.



  [ # 2 ]

Thank you, it worked for sometimes and sometimes it doesn’t. I will need to dig into the flow and logic of whats going on.


  [ # 3 ]

Hi guys are great. I am making a lot of progress on my learning and bots thanks to you all.
So it works so if I have several files.,, and,,

Each time, my gets called, it does not go back to the place that it was called from, instead it always goes to For example, say I am in my and I say a phrase that calls a response from, it goes to after, it doesn’t come back to

Any way to fix this? Thanks


  [ # 4 ]

There is a function ^poptopic.  The Chatscript-system-functions-manual says:

ˆpoptopic( topicname )
Removes the named topic as a pending topic. The intent is not to automatically
return here in future conversation. If topicname is omitted, removes the current
topic AND makes the current topic fail execution at this point.

You can force a topic with:

ˆaddtopic( topicname )
adds the named topic as a pending topic at the head of the list. Typically you
don’t need to do this, because finding a reaction from a topic which is not a
system, disabled, or nostay topic will automatically add the topic to the pending
list. Never returns a fail code even if the topic name is bad.

Also there are topic control flags described in the chatscript-advanced-user-manual.

There is a “random” flag to randomly search the rules.
There is a “nostay” flag to not stay in the current topic which seems to be what you need.


topic: ~test random nostay ( test president stupidity stupid name )

u: (you are stupid) that is mean
u:(who is the president) Donald Trump
u:(what is your name) I told you my name, it is Harry

Also, Chatscript will not reuse the same rules once they have been used at least for awhile so if you are testing and it works the first time but not the second then that is why.

You can use “keep” and “repeat” on a topic if you want to test it repeatedly:

topic: ~test random nostay keep repeat ( test president stupidity )



  login or register to react