Giter VIP home page Giter VIP logo

Comments (5)

dcsan avatar dcsan commented on May 29, 2024

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

image

from botml.

dcsan avatar dcsan commented on May 29, 2024

perhaps things would be better if there was a more explicit @ return or some type of keyword like that?

from botml.

arnaud avatar arnaud commented on May 29, 2024

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]

▶ Play this script

from botml.

codenametype avatar codenametype commented on May 29, 2024

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.

arnaud avatar arnaud commented on May 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.