Closed dcsan closed 4 years ago
as in the above example, if the match is in one of the conditions it will not 'return'
---
> red
< roses are red
but if the reply is caught as the default/bottom entry of the logic block, then the code will return and continue, it seems.
---
> *{color}
< you like $color
perhaps things would be better if there was a more explicit @ return
or some type of keyword like that?
You'll find the reasoning behind conditional, and some examples, in this post: https://github.com/codename-co/botml/issues/42#issuecomment-518370648
The only way I can think of right now, for addressing your example, would go like this:
~ start
< start
[intro]
~ [colors]
~ [ending]
~ colors
< Whats your favorite color?
> *{color}
< you like $color
\`\`\`
if ($color === 'blue') {
context.say('sky is blue')
}
\`\`\`
= intro
- Let's begin
~ ending
< Thanks and goodnight.
> reset
~ [start]
Hi! Sorry for the very late response. According documentation Conditional branching please look on the last example and "jump_to" feature you could jump from a condition to the end of current dialogue. ▶ Play this script
Example:
~ start
< start
[intro]
~ [colors]
~ [ending]
~ colors
< Whats your favorite color?
> *{color}
---
` /red/.test('$color')
< roses are red
~ [end]
---
` /blue/.test('$color')
< sky is blue
~ [end]
---
< you like $color
~ end
= intro
- Let's begin
~ ending
< Thanks and goodnight.
> reset
~ [start]
Hope it helps you.
Hi. I'm assuming the latest answer was useful, and this ticket closed.
Do not hesitate to reach again if not,
sometimes when a conditional matches a response, the conversation will seem to return and continue. but other times it does not. I can't quite figure out the logic.
given this example
on bubbles