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

Bug in working draft document

Open johnnymast opened this issue 4 years ago • 2 comments
trafficstars

While developing Rivescript-php I noticed a bug in the working draft document for Rivescript.

Here is the script:

  + <input1>
  * <input1> eq <input2> => That's the second time you've repeated yourself.
  * <input1> eq <input3> => If you repeat yourself again I'll stop talking to you.
  * <input1> eq <input4> => That's it. I'm done talking to you.{topic=blocked}
  - Please don't repeat yourself.

All lines past are unreachable.

 * <input1> eq <input2> => That's the second time you've repeated yourself.

Fix:

Update document accordingly.

johnnymast avatar Aug 07 '21 22:08 johnnymast

Hey, thanks for pointing this out. That code example was probably written without testing when I was writing the working draft. 😅

The input checks had to be flipped in a different order (<input4> first):

+ <input1>
* <input1> eq <input4> => That's it. I'm done talking to you.{topic=blocked}
* <input1> eq <input3> => If you repeat yourself again I'll stop talking to you.
* <input1> eq <input2> => That's the second time you've repeated yourself.
- Please don't repeat yourself.

> topic blocked
    // NOTE: "<noreply>" is handled in your bot's code, to not
    // show a reply to the user; it isn't a RiveScript tag.
    + *
    - <noreply>

    + sorry
    - {topic=random}Ok I'll forgive you.
< topic

Playground link: https://play.rivescript.com/s/4LBzyPNBRz

I've updated the Working Draft to fix this example with a more fleshed out version: https://github.com/aichaos/rivescript-wd/blob/master/WD.rst#input1-input9-reply1-reply9

Also, the <noreply> tag is now officially guaranteed to never be used by RiveScript; in my chatbots I've always returned a literal <noreply> string to my program so it would know not to deliver a response back to my message. That use case comes in handy sometimes!

(the Playground site doesn't handle <noreply> tags yet and tries to show it as literal HTML and you get an empty response bubble)

kirsle avatar Aug 13 '21 04:08 kirsle

Thanks, I will check this out and might even make it a test case in my project.

johnnymast avatar Aug 13 '21 07:08 johnnymast