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

Scope of local variables
 
 

Hello everyone,
I upgraded to the last version of ChatScript (6.83) and I started to play around with the local variables. While they work perfectly with the outputmacros I have a problem with the topics.

As per documentation:

Local variables used in a topic all remain accessible while in that topic.

the scope of a local variable in a topic should be the topic itself and not the rule where it’s declared. But this is not the case.

For instance, this code doesn’t work:

t: Do you want to set a local variable?
   
a: (~yesanswerNice $_local 1
   a
: ( ~noanswer ok $_local 0

t
: ($_local=1You set the variable!

t: ($_local=0You did not set the variable!

tCHECK () The value of the local variable is$_local 

The variable is resetted after the first gambit, hence only the CHECK gambit is outputted and the variable results undefined.

Is this a bug or I’m doing something wrong?

Thank you in advance,
Dario

 

 
  [ # 1 ]

sorry i wasnt clear. Local variables are not global and not permanent. merely transient to a volley

 

 
  [ # 2 ]

Thank you for clarifying and for the fast reply!

 

 
  login or register to react