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..

How to jump to another topic?


I am new to chatscript and I wanted to ask a few specific questions regarding “how to manage the flow of the conversation”

1. This is an important one: I don’t know how to hard code the flow of a part of the conversation. In particular: I don’t know how to make the bot jump to another topic when a particular answer has been given USING gambit.

Look at the following code:

topic: ~firsttopic keep (~concept1)

u: () Something something
: (~conceptAFirst Option. ^gambitsecondtopic )
a: (~conceptBSecond Option. ^gambitthirdtopic )
topic: ~secondtopic keep ()


topic: ~thirdtopic keep () 

I would like the second a: to make the bot jump straight to ~thirdtopic. As it stands, it would go to ~secondtopic instead.
So far, I think I’ve made it work using variables - so that it checks if a variable exists and is not null in order to be allowed to move on to another topic.

topic: ~firsttopic keep (~concept1)

u: () Something something
: (~conceptA$answer1 _0 First Option. ^gambitsecondtopic )
a: (~conceptB$answer2 _0 Second Option. ^gambitthirdtopic )
topic: ~secondtopic keep (~answer1)


topic: ~thirdtopic keep (~answer2

However, I would not like it do it that way. I would like to “hard code” transitions to another topic using gambit. I have tried in many ways but it does not work. I could not get anything out of the documentation either.

Is that actually possible? If so, how do I do this?



  [ # 1 ]

Did you try the example in the advanced user manual, around page 28

u: ( some test ) I like fruit and vegetables. ^reuse(COMMON) And so do you.

and page 54

u: SELF (where * you * live) ^disable(RULE SELF) ^reuse(HOUSE)

here is something close:

“Now, suppose you want to notice that you already told the user about the house
so if he asks again you can say something like: You forgot? I live in a small
house. How can you do that. One way to do that is to set a user variable from
HOUSE and test it from the responder.”

t: HOUSE () I live in a small house $house = 1

u: ( where * you * live ) [$house You forgot?] ^reuse(HOUSE)


  [ # 2 ]

You mean this? User Manual.pdf

I know about using variables as conditions.

What I am asking is:

How would I jump from topic: to topic: using something like ^gabmit? I use ^reuse to jump from u: to u: (or u: to t: and so on). Gambit does not work for this. In fact, gambit does not work for me at all. Maybe I’ve understood what ^gambit() is supposed to do.
So far, I’ve defined multiple topics. Each one is “sort of” initiated by checking if a variable has been instantiated (and is not null). I could just instantiate multiple variables so the bot cannot activate a topic unless a certain variable is not null.


topic: ~XYtopic keep (~variableXY[]

: (~variableXY) .... 

This topic is not “launched” unless the bot has been at the point where ~variableXY receives ANY value. Fair enough, but do I really have to do it this way? Is there not a better alternative?



  [ # 3 ]

Your illustrated code uses ^gambit but does not use a topic name. topic names ALWAYS begin with ~


  [ # 4 ]

So far, I think I’ve made it work using variables - so that it checks if a variable exists and is not null in order to be allowed to move on to another topic.

topic: ~firsttopic keep (~concept1)

u: () Something something
a: (~conceptA) $answer1 = _0 First Option. ^gambit( secondtopic )
a: (~conceptB) $answer2 = _0 Second Option. ^gambit( thirdtopic )

This code does not check if a variable exists.  the $answer1 = _0 has no meaning or real effect here


  [ # 5 ]

As for the ~: I’ve got it both ways (a fewtimes with ~ and a few times without. I’ve just tested this and in some instances ~ is missing, that’s why I thought it didnt work.
Next thing I’ll do is refactor code and make it look less like noodle code. Sorry.

I have another question, which is sort of to confirm if my observations are correct:

Look at the folliwng code:

topic: ~generictopic keep  []

: ($var1Hello

: () What do you want

I’ve got it like this a few times in my current project. I would like to ask to make sure I know what I’m doing:

1. The bot does not say “Hello” in this topic unless the variable $var1 actually exists, right?
2. If t: is not triggered then the following u: canot be reached either (with the way it is in my example), right?




  [ # 6 ]

#1   true.  $var1 must be defined
#2 u: is unrelated to t: —a topic is entered either in gambit mode or responder mode. the rules are on unrelated paths


  [ # 7 ]

for your gambit(xxx) questions, best thing to do is :trace all and then give your input and see what the trace says


  [ # 8 ]

Thank you!

I have yet another, very basic question. CTRL+F through the tutorials and manual did not help -

How do i terminate Chatbot when, say a certain topic is reached?


  [ # 9 ]

What does it mean to “terminate a chatbot”?  Do you mean to refuse to talk to some user anymore?

You can detect you have some specific user and just keep sending back nothing to them.


  [ # 10 ]

What I meant by that was giving a sort of “Good Bye” message and having the bot no longer react to user input. Maybe even cause chatscript.exe / chatscriptpg.exe to end even.


  [ # 11 ]

if you want chatscript to exit, presumably you are NOT using it as a server (otherwise you prevent all others).  You can certainly no longer react to user input (by putting out a blank response) or exit the server using ^eval(:quit)


  [ # 12 ]

^eval(:quit) worked just fine. I wasn’t able to find it in the Documentation by ctrl+f. Is there a documentation I am missing out on enitrely?

Anyhow, many thanks!


  login or register to react