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

^SetTokenFlags()
 
 

I want to set the token flags for my user input. To do this I’m copying code written in the documentation here: https://github.com/ChatScript/ChatScript/blob/master/WIKI/ESOTERIC-CHATSCRIPT/ChatScript-Exotica-Examples.md

The line containing SetTokenFlags(#QUESTIONMARK) however never executes, as it presumably interprets the flag as a comment. My code:

#! This is not a question
u: (question) ^settokenflags(#QUESTIONMARK)

#! Neither is this
?: (neither) Yes, it is!

I have also tried leaving off the ‘#’, but it makes no difference. Thanks in advance!

 

 
  [ # 1 ]

Changing the tokenflags will not take effect in the topic you are executing, because it has already selected the type of rules to try to execute. So maybe that is the problem.  What is your test case example?

 

 
  [ # 2 ]

I have the first rule executing in my `$cs_control_pre = ~pre` topic in the control script. The second `?:` rule is in the ~introductions topic, the first topic that is gambitted from when loading the bot.

The ~pre topic looks like this:

```
topic: ~pre system repeat ()

t: (explain) ^settokenflags(#QUESTIONMARK)
```
and the ~introductions topic contains this rule:

```
topic: ~introductions keep repeat ()

#!x matches every time on startup of a new conversation
t: ( %input<%userfirstline )
^keep() 
Welcome to ChatScript.

#! Please explain tetris to me.
?: QUESTION (tetris) Sure, I love talking about Tetris!
```

My understanding is that for every volley the ~pre topic is triggered first, flags the input sentence and then matches it with in the most relevant topic. Thus, the `?:` rule should be triggered after the first introduction gambit is outputted.

 

 
  [ # 3 ]

The nature of topics is that topics that have no possible context operate as gambit topics. so…
`$cs_control_pre`  -  name of topic to run in gambit mode on pre-pTopass, set by author. Runs before any sentences of the input volley are analyzed. Good for setting up initial values

Control scripts that run on each sentence of the volley are responder topics.

You have used the wrong kind of pre-topic. Your topic is invoked in gambit mode and with no sentence context. Although you can call your topic from near the beginning of your actual main control script, you probably want to do it as this:
`$cs_prepass`      |  topic used between parsing and running user control script.
This is run on every sentence and uses responders as rules

 

 

 

 
  login or register to react