aichaos / rivescript-python

A RiveScript interpreter for Python. RiveScript is a scripting language for chatterbots.
https://www.rivescript.com
MIT License
157 stars 71 forks source link

variable undefined #116

Closed kimmanlui closed 6 years ago

kimmanlui commented 6 years ago

Hi I executed the following script below. However, the variable, name, is "undefined," and the following test script always returns "You didn't tell me your name." Is it a version problem? Thanks,

! version = 2.0 ! var name = UAVA ! var age = 1 ! sub what's = what is ! array colors = red blue green yellow cyan magenta black white

+ what is my name * \<get name> != undefined => Your name is \<get name>. - You didn't tell me your name.

kirsle commented 6 years ago

Hi

The variables defined by ! var are actually bot variables, not user variables, so <bot name> is how you'd retrieve them.

The <get> tag is for getting user variables, and you use <set> to set them.

These should work:

! var name = UAVA

+ my name is *
- <set name=<formal>>Nice to meet you, <get name>.

+ what is your name
- I am <bot name>.

+ what is my name
* <get name> != undefined => Your name is <get name>.
- You didn't tell me your name.