Comments (5)
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
from botml.
perhaps things would be better if there was a more explicit @ return
or some type of keyword like that?
from botml.
You'll find the reasoning behind conditional, and some examples, in this post:
#42 (comment)
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]
from botml.
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.
from botml.
Hi. I'm assuming the latest answer was useful, and this ticket closed.
Do not hesitate to reach again if not,
from botml.
Related Issues (13)
- Events get triggered only when the conversation is over HOT 1
- could you add also bower.json HOT 1
- Ability to load script manually HOT 2
- Load other .bot files HOT 2
- Start bot from checkpoint or previous point HOT 2
- design questions HOT 4
- how to instance for multiple conversations? HOT 4
- conditional logic problems HOT 8
- Does this support length wildcard??? HOT 1
- Lack of Documentation HOT 4
- Return bot reply to client side, instead of server side log HOT 3
- licensing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from botml.