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

make permanent an option in trigger, without writing it on triggers #115

Open
elpimous opened this issue Feb 17, 2018 · 4 comments
Open

Comments

@elpimous
Copy link

elpimous commented Feb 17, 2018

Hi Noah, hi all,
I continue Alfred s' brain (a physical Alive robot)
When I communicate with Alfred, I ofter tell "Alfred", at the beginning or end sentence :
How could I tell the program : forget alfred word ??

ex :

+ [alfred] power on the tv [alfred]

I'd like rivescript to ignore this word when i speak it. So I will not have to write it everywere !

Sure I could erase it on python with a replace command, but I'd like to do it under a rive file !

@sucream
Copy link

sucream commented May 16, 2018

I think you can use default trigger in begin.rive.
This trigger is matched before other all triggers.

check this tutorial
https://www.rivescript.com/docs/tutorial#the-begin-block

> begin
	+ request // This trigger is tested first.
        - {ok}
< begin

@elpimous
Copy link
Author

Hi,
I tested, and it doesn't work

@kirsle
Copy link
Member

kirsle commented Jun 19, 2018

Something like this maybe:

+ alfred *{weight=100}
- <@>

+ * alfred{weight=100}
- <@>

The high weight value should ensure the trigger gets tested first (unless you have other triggers with weight >100). If it begins or ends with the word "alfred" it just redirects to a trigger without that word.

It may be possible to combine them into one trigger, but using optionals on either end like your original example might backfire: the first iteration you'd match the [alfred] * [alfred] trigger and it would match whether or not you said the word alfred (because it's optional, you see), and it would redirect to <star> and it would test [alfred] * [alfred] first again, and repeat forever.

@elpimous
Copy link
Author

elpimous commented Jun 20, 2018

Perfect, Noah. So simple...
Thanks

ps : this test failed

+ [alfred] * [alfred]
- <@>

+ bonjour *
- salut

question :  bonjour alfred
[ERR: Deep recursion detected]

This worked :

+ alfred *{weight=100}
- <@>

+ * alfred{weight=100}
- <@>

Hope it will help each other !

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

3 participants