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

Ordered topics in the control script

As a new user, I’m trying to get the hang of control scripts. I’m trying to build an interviewer application that asks questions about a bunch of pictures. I’ve created separate topics for each picture, but I’m having problems getting ChatScript to select the topics in the order I choose.

I’ve got it working on Windows by renaming the topic files to be in alphabetical order, but that doesn’t seem to work on my Linux server. Instead of alphabetical order it’s selecting them in some arbitrary order I can’t seem to figure out.

I’m not sure what other information you might need. I’ve changed the to do

instead of

. Please let me know if this isn’t enough information to help.


  [ # 1 ]

There are MANY ways to perform control over topic flow. Your plan is to have the control topic that would pick from topics with available gambits in fixed order instead of random order, but your topics themselves have no inherent order at present except by order of building (hence trying to name your filenames in particular way), which varies by system compiled on.


1.  Instead of randomly picking topics to gambit, you can change control to EXPLICITLY do them first.  One way is to insert before the
if (%response == 0)
@8 = ^GambitTopics() # all topics with gambits (excluding system topics)

if (%response == 0) { ^gambit(~myfirsttopic) }
if (%response == 0) { ^gambit(~mysecondtopic)}  etc

OR, you could just do the gambit on ~myfirsttopic and at the END of that topic have a gambit:
t: ^keep() ^gambit(~mysecondtopic)
and that topic links to the third, etc

A more “esthetic way” is to do this in the control script:
if (%response == 0) {
query(direct_vo ? member ~mytopics)
$$topic = ^first(@0subject)
if (%response != 0) {end(RULE)}

And SOMEWHERE in your source have a concept declared that names your topics in order:
concept: ~mytopics [~mytopic1 ~mytopic2 ... ]
This is more esthetic because you don’t mess up your topic code with extra gambits that have to stay around, and you can add or change the order of calls just by revising the concept.


  login or register to react