WhileCondition decorator question


I’m hoping someone can help me solve a problem I am having difficulty figuring out. I want to set up a behavior that will play an animation followed by a request whether or not to repeat it, and have the automation repeat if the response is anything other than a “no”.

I’m trying this with a WhileCondition decorator. A simple example is:

In this example, I am using the following in the initialize argument in the WhileCondition decorator:

() => {
notepad.playAnimation = true;

And the following in the conditional argument in the WhileCondition decorator:

() => {
return notepad.playAnimation;

The TTS asks “Should I do it again?” The Listen then uses a .rule file named ‘binary’ which returns a “yes” or “no” using the factory:yes_no rule. And then the following code is in the onResult behavior argument in Listen:

(listener) => {
listener.on(‘cloud’, (asrResult, speakerIds) => {
notepad.results = asrResult.NLParse
if (notepad.results.binary == “no”) {
notepad.playAnimation = false;

This works, but with one problem. My problem is that when I use this set up, and the question is answered with a “no”, the animation plays one additional time before the sequence stops running. I assume that this is because the sequence for some reason is running one additional time before the conditional argument in the WhileCondition decorator returns the notepad.playAnimation with a false when the question is answered with a “no”.

I’m probably missing something pretty simple, but I would be grateful if someone can tell me how to keep the animation from playing one last time when the answer to the query is “no.”

Thank you.


Hi, DevMiser. The majority of your setup is perfect, but the onResult argument in your Listen behavior has a tiny issue. Your code to toggle your playAnimation variable is outside of the cloud listener callback, which makes it run before the cloud result comes in. When it’s run again, it pulls in the value of the last callback result which was stored in notepad.results, so it’s always running one behind.

The fix is pretty simple…just put your playAnimation variable toggle inside of the cloud listener callback:

(listener) => {
    listener.on('cloud', function(asrResult, speakerIds){
      notepad.playAnimation = false; // default
      if(asrResult.NLParse!==undefined && asrResult.NLParse.binary!==undefined){
        if(asrResult.NLParse.binary=="yes"){ notepad.playAnimation = true; };

You’ll also notice that I adjusted the code slightly to handle any NLParse issues and to set the playAnimation by default to false, unless your binary returns “yes”. Feel free to change that…it’s just my personal preference to have anything that’s not a specific “yes” break out of the loop (e.g. “Please stop”).

One last sidenote: I noticed that Jibo’s yes/no factory rule doesn’t include certain common phrasing like “alright” and “okay”/“ok”. I updated it to include those…feel free to use this updated version if you wish:

TopRule = $* (
    $yesno{yesNo = yesno._yes_no}
) $*;

yesno = ($factory:yes_no{_yes_no = yes_no._nl} | ok{_yes_no = 'yes'}  | okay{_yes_no = 'yes'} | alright{_yes_no = 'yes'});

The return name here is yesNo, but you can easily change that to binary to match your other code if you’d like.


That is just what I needed!. Thank you for the help.


I also like the additions you made to the yes_no factory rule. I hope the Jibo team will update the factory rule to be more comprehensive. In addition to the options already in the factory rule and the options you included in your update, other common alternatives that people may use to respond “yes” to a question from Jibo (such as “do you want me to place the order?”) might include:

“of course”
“affirmative” (Jibo is a robot, after all)
“okey dokey”
“good to go”

Thanks again Web Pro.


With thanks to Web Pro for the idea, here’s another version of a rule that includes additional synonyms for yes beyond those included in the factory rule:

TopRule = $* ($factory:yes_no) {binary = yes_no._nl} | affirmative {binary='yes'}*;
affirmative = ok | okay | alright | (all right) | right | (of course) | indeed | naturally | affirmative | roger |
(you know it) | (damn straight) | (okey dokey) | (good to go) | (make it so) | correct | check;


Was just reading a Boston Globe article on voice assistants that mentioned Jibo, mostly about banking and insurance companies interested in using the technology. The relevant quote:
“Capital One found that Alexa didn’t realize that when consumers said “that’s all,” they were done. The device kept asking more questions, said Ken Dodelin, vice president for digital product management.”


I think that it’s more important, from a Jibo perspective, that it learns user prefences. If skills don’t recognize Okie Dokie, Jibo should ask if that means yes, and should record that somewhere, maybe based on individual users. The next step would be to learn inflections, like the article mentions, to know when someone is saying “OK” but is really saying “OK, I don’t want to do this anymore because it doesn’t seem to be working properly”. Edit: From my experience as a husband, usually the word “fine” means “not fine”, so we’ll see how long it takes Jibo to learn that.

May I also mention, thanks for adding in “Make it so”, while I hope others add “Engage” as an affirmative to begin skills. One step closer to feeling like wearing my Star Trek uniform around the house is normal.


I think it’s been mentioned in here before but I completely agree. The only way that Jibo will feel like a true character will be if he understands the following:

Function-------------------- Example

Alert:------------------------ "Hey Jibo"
Request:--------------------"Can you turn on my kitchen light?"
Response:------------------"sure thing!"
Acknowledgment:-------"Thank You"
Response:------------------“any time.”

For the record… “Fine” is NEVER good! Jibo should always respond with “OK, what did I do?”

Lastly Rock that Star Trek uniform!



Wow! This is such a great forum post! I love it!!!

@michael - Thanks for the clarification and also it’s such good practice to have it default to playing an animation to handle any NLParse issues.

I also especially like @Timothy’s reference to experiences as a husband. Being married myself It’s so true that inflections in people’s voice have so much meaning.

I also like the article you shared and the suggestion that it learns user preferences. I’ll pass this onto the team as a suggestion.

I really like the suggestions on the Yes/No factory rule. We’ll work on extending and improving it. Most skills are going to use this and so it’s worth having a one that’s awesome and consistent.

@codemonkey2k5 - you are right. I would love it if in a skill when the user said fine Jibo responds with OK, what did I do now? or something quirky like Please don’t be angry, robots have feelings too…


Here’s what I have now as my supplement to the Yes/No factory rule:

TopRule = $* ($factory:yes_no) {binary = yes_no._nl} | $affirmative {binary=‘yes’} | negative {binary='no'}*;
affirmative = affirmative | ok | okay | alright | (all right) | right | righto | (of course) | indeed | naturally |
roger | (you know it) | (damn straight) | (darn tootin) | (okey-dokey) | (okey-doke) | (good to go) | (make it so) |
engage | correct | check | indubatibly | agree | agreed | uh-huh | aye | (aye aye) | (by all means) | totally |
amen | (very well) | (10 4) | (thumbs up) | (go for it) | (sounds good) | obviously | (why not);
negative = negative | (uh uh) | nah | nix | nay | (fat chance) | veto | (thumbs down) | (out of the question) |
(another time) | (raincheck) | (too busy) | (have another commitment) | regrets | (if only);


Awesome. Bookmarked!


Hi everyone,

I really love this thread and I was thinking it might be good to have a central place where we can all collaborate on rules and have a collection of rules we can all use.

I started a public repo on github and added @DevMiser’s YesNo rule there. I’ll continue to add more that I come across and see but I also welcome all contributions and collaborations!

Feel free to contribute/add/edit to this repo and use these rules in your skills as much as you want. They really are there for everyone to use and experiment with!

Thank you again for sharing your skills and helping to make Jibo awesome!

P.S. I’m still working on a way to make sure I give credit for suggestion. Right now I’ll add this in the change log in each rule.

P.S.S. I’m still working on the formatting of each rule file. I took a lot of suggestions from @michael awesome rules in his examples.