AI Zone Admin Forum Add your forum

Chatbot Conference in the Netherlands on Tue 24, 2018, with international line-up! Check it out

Temporary and system variables
 
 

I’m blocking on the use of temporary and system variables. I would like to activate a rule that depends on another.
Example :

# Do you drink alcohol
u: (vous bvez de l’alcool)
$apero = 1
oui

# at what frequency
u: (à quelle fréquence vous buvez)
if ($apero==1){
une fois par mois
}else{
je ne bois pas
}

The problem that as soon as it finds the variable apero equal to the value 1 it gives the right answer only that even after relaunching the system the variable apero remains fixed to 1 and the answer of the second rule is not the good one.

Thanks to help me

 

 
  [ # 1 ]

The system remembers values of global permanent variables across volleys, which is the behavior you sought for your second rule (that it trigger if the user asks the question after the first (different volley). You dont even clear the variable after using it in the second volley. But of course the user may not ask. You “could” store the volley id on the variable instead of 1, and check that the id is within a small range for the 2nd rule. Which would be the cumbersome way of using “^inContext” function.

 

 
  [ # 2 ]

Thanks very much, I tried “^inContext” function and it corresponds to what I want. I take the opportunity to ask if several rules can share the same label name

 

 
  [ # 3 ]

Also, is there one function to extract the recent volley id which are not failed?

 

 
  [ # 4 ]

multiple rules can have the same label, incontext accepts that.

I dont understand your volley id question

 

 
  [ # 5 ]

I would know if there is a function to retrieve contexts that have succeeded in a short time

 

 
  [ # 6 ]

Still not sure I follow your meaning.  If a rule matches because of incontext in a pattern, did you want to get what rules fired because of that?  There is no function for that, but you can write an outputmacro to put into the output side of a rule to detect and record that somewhere

 

 
  [ # 7 ]

In fact my question is related to the history in the conversation with the bot. I would like to be able to recover for example the labels of the last five rules which have been triggered (and which actually have a label). Do I have to write an outputmacro as you indicated?

 

 
  [ # 8 ]

Yes, you have to write your own function. But you dont have to put in every rule, merely put code in a postprocess to retreive rule ids used to generate output and save them as you wish

 

 
  login or register to react