rivescript-python icon indicating copy to clipboard operation
rivescript-python copied to clipboard

! var definition is ignored

Open oakandsage opened this issue 6 years ago • 4 comments

Using version 1.14.9, with the following begin.rive

! version = 2.0

! var myvar = hello

+ print
- myvar is <get myvar>

I expect that the user input print will result in myvar is hello but instead, it results in myvar is undefined

I also tried putting the print trigger into a different file titled hello.rive but this didn't change the behavior.

oakandsage avatar Jun 14 '18 07:06 oakandsage

Hi

! var myvar = hello sets a bot variable named myvar and you'd retreive it with <bot myvar>

User variables are set with <set> and retrieved with <get>.

! version = 2.0

! var myvar = hello

+ print
- myvar is <bot myvar>

kirsle avatar Jun 14 '18 15:06 kirsle

Oh, that makes sense. Thanks... Sorry for the bad issue. My problem was that I was going off the code snippets in the tutorial, which briefly mentions bot variables and then goes back to discussing user variables with the same name, so I didn’t correctly identify which code snippets were related to ! var. I guess it doesn’t even make sense to initialize user variables that way, since that would create issues in a multi-user environment.

On Jun 14, 2018, at 8:43 AM, Noah Petherbridge [email protected] wrote:

Hi

! var myvar = hello sets a bot variable named myvar and you'd retreive it with

User variables are set with and retrieved with .

! version = 2.0

! var myvar = hello

  • print
  • myvar is — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

oakandsage avatar Jun 14 '18 18:06 oakandsage

I agree naming the command "! var" to set them and to get them is confusing. Same applies to the other types of variables.

snoopyjc avatar Mar 22 '20 03:03 snoopyjc

Hi, Author of Rivescript-PHP here, This is kind of off-topic but the Rivescript specs also dictate you can set bot variables in responses. This is something I missed while implementing the bot command.

+ init 
- <bot name=Johnny>done.

+ what is your name
- my name is <bot name>

I know this is off the topic of this issue but I assume not many developers know of this ability.

johnnymast avatar Feb 13 '22 22:02 johnnymast