AI Zone Admin Forum Add your forum

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

Variable based random output
 
 

I have the following script:

u: TALKABOUT (~speak_verbs * {about} * {something}>) How about [religion? $context = religion][movies? $context = movies][books? $context = books]

a:([~noanswer nope]) Ok. Let’s pick a topic other than $context reuse(TALKABOUT)
a: TOPICTREE ([~yesanswer ok okay fine sure shoot]) if ($context==religion) {Lets talk about God}
else if ($context==movies) {Lets talk about Gladiator}
else if ($context==books) {Lets talk about Pratchett}

As you can guess the first rejoinder can pick the same previous context again in the random output. Is there any way to make sure an element of random output zone isnt selected, maybe based on a variable test?

 

 
  [ # 1 ]

sure.  choice blocks can be controlled by a variable having a value or not…

[$male You might like a gun.][$female You might like a dress.][You might like a car.]

So elsewhere on startup initialize variables $religionavailable $moviesAvailable $booksAvailable and then do this
[$religionavailable $context = religion $religionavailable = null] ....

 

 
  [ # 2 ]

Even cleaner however is that you can ! in front of the test.  So you might do this
[!$religionused $context = religion]  ....
and then in the religion topic as part of the 1st gambit do $religionused = 1 so that if you got to the religion topic earlier because someone asked about god, you wouldn’t then later offer them the religion topic.

 

 
  login or register to react