We are trying to create small dialog trees with CS. We are struggling on a specific case: we want the conversation to follow different subtrees, but to come back at next step once finished.
A simple example:
Some simple text. Question?
Answer 1 : bla bla bla
Answer 2 : bla bla bla
*Some text that should trigger one the user is out of Answer 1 or Answer 2 sub trees.*
It can be nested at different sublevels:
Some simple text. Question?
Answer 1 : bla bla
Answer 2 : bla bla. Question?
Answer 2.1 : bla bla
Answer 2.2 : bla bla
*Some common text for Answer 2.1 and Answer 2.2 sub trees.*
*Some commun text once out of Answer 1 and Answer 2 sub trees.*
A sample conversation I’d like to have:
bot: Some simple text. Question?
user: Answer 2
bot: bla bla. Question?
user: Answer 2.1
bot: Some common text for Answer 2.1 and Answer 2.2 sub trees. Some commun text once out of Answer 1 and Answer 2 sub trees.
This kind of code pattern works, using rule labels and goto via ^reuse:
u: (test3)
Some simple text. Question?
a: (Answer 1)
bla bla. ^reuse(A3_1)
a: (Answer 2)
bla bla. Question?
b: (Answer 2.1)
bla bla ^reuse(A3_2)
b: (Answer 2.2)
bla bla ^reuse(A3_2)
u: A3_1 ($dont)
Some commun text once out of Answer 1 and Answer 2 sub trees.
u: A3_2 ($dont)
Some common text for Answer 2.1 and Answer 2.2 sub trees.
^reuse(A3_1)
But I don’t like it - too complex.
What could be a better pattern?