Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in working draft document #373

Open
johnnymast opened this issue Aug 7, 2021 · 2 comments
Open

Bug in working draft document #373

johnnymast opened this issue Aug 7, 2021 · 2 comments

Comments

@johnnymast
Copy link
Contributor

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.

@kirsle
Copy link
Member

kirsle commented Aug 13, 2021

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)

@johnnymast
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants