superscriptjs / superscript

A dialogue engine for creating chat bots
http://superscriptjs.com
MIT License
1.65k stars 209 forks source link

Support multiple triggers for a gambit #352

Open IanRogers-LShift opened 7 years ago

IanRogers-LShift commented 7 years ago

E.g. what I'd like to do is something like

+ the cat sat
+ the dog ate
+ the flea jumped
+ the cow mooed
- animals are cool

+ *
- I don't think you have that right

there are two workarounds I can see but they're both a bit unhelpful:

+ (the cat sat|the dog ate)
- nice

+ the flea jumped
- {@__respond__}
+ the cow mooed
- {@__respond__}
+ __respond__
- indeed

The first (trigger one|trigger two|..trigger N) seems exactly equivalent to having each trigger on its own line.

NB. yes I know this particular example could be implemented as

+ the ~animal <verb>

but

  1. this is just a simplified example and the real problem can't be solved that way
  2. it would allow daft combinations like "the cat mooed" which I want to trap