Transparent logic via preprocessor

Preprocessor allows you to declare digression, which should work transparently from the point of view of the script. If during the processing of an event a transition is made to the preprocessor, then after returning to the node, processing of the event will continue from the same place where it was interrupted.

Example

The preprocessor can be used for user phrases counting during the whole dialogue.

main.dsl

context { output phraseCount: number = 0; } start node root { do { #connectSafe("myEndpoint"); goto askCountinue; } transitions { askCountinue: goto askCountinue; } } node askCountinue { do { #say("Do you want to talk?"); wait *; } transitions { listen: goto listen on #messageHasSentiment("positive"); @exit: goto @exit on #messageHasSentiment("negative"); } } node listen { do { #say("Ok. I'm listening."); wait *; } transitions { askCountinue: goto askCountinue on true; } } node @exit { do { #say("Goodbye then."); set $phraseCount = digression.phraseCounter.count; exit; } transitions { } } // Each time interlocutor say a phrase, we count it // then return to the waiter and continue to handle a phrase. preprocessor digression phraseCounter { conditions { on true; } var count: number = 0; do { set digression.phraseCounter.count += 1; return; } }
Found a mistake? Email us, and we'll send you a free t-shirt!

Enroll in beta

Request invite to our private Beta program for developers to join the waitlist. No spam, we promise.