Capturing random responses in the "previous" (%) command
See original GitHub issueI have a question about rivescript syntax in general. Please do point me to a more suitable platform if this is meant to be for discussing issues specific to the js interpeter.
I’d like to use the %
command, but my previous trigger has multiple responses. My first hunch was to use a redirect, but this doesn’t work:
+ hello
- Hi!
- Such a nice day
- How are you?
+ *
% {@ hello}
- Feeling great.
The only way I can figure it out is to have a separate trigger-previous block for each of the three random responses to “hello”:
+ *
% hi
- Feeling great.
+ *
% such a nice day
- Feeling great
+ *
% how are you
- Feeling great
Is there a nicer approach to this?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Shell programming: Select random line from command output
srand() seeds the random generator, and rand() returns a random float >= 0 and < 1; ... shuf selects random directory from your...
Read more >Tutorial - RiveScript.com
Getting random responses is as easy as entering multiple Response commands for the same trigger. To see this in action, open your hello.rive ......
Read more >Panel Data Analysis Fixed and Random Effects using Stata
The Stata command to run fixed/random effecst is xtreg. Before using xtreg you need to set Stata to handle panel data by using...
Read more >Lots of Ways to Use Math.random() in JavaScript - CSS-Tricks
Math.random() is an API in JavaScript. It is a function that gives you a random number. The number returned will be between 0...
Read more >Controlling Random Number Generation - MathWorks
This example shows how to use the rng function, which provides control over random number generation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Use an alternation group in the
%Previous
like you can with+Trigger
:maybe you can break into separate topics? I find we don’t use the
%
operator as much here, as it’s sometimes less clear to read the code later.