Version 6.0.0 released with minor changes for rule triggersMay 10, 2020
I’ve just released a new version of the Elm Narrative Engine. This makes a minor change to the rules system to allow for non-entity rule triggers. In other words, you can now trigger rules by matching a specific string, or by using an entity matcher as before.
Why is this useful? It allows for more flexibility for triggering rules. For example, if you want to trigger a rule programatically, such as a “next-day” or “wait” rule, now you can. I am working on a game currently where I had that exact need, which is what prompted this change.
You can also create an ad-hoc interaction system with this. For example, if you want to add the classic “use X with Y” style mechanic, you could build a UI to do that, which creates a trigger “X+Y”. You can then add a rule with that trigger. Of course, you can have multiple rules triggered by that string, and use conditions to check different properties of X or Y or anything else in your store, just as before.
You could do something similar if you wanted to create verb-noun style interactions, such as “read-LETTER” and “drop-LETTER”. This works, but isn’t where the Elm Narrative Engine shines, so use this approach with caution because it will involve manually creating more rules.
As far as breaking changes, if you define your rules in code you will need to adjust the triggers in order to compile. But, if you use the rule syntax parsers, you won’t have to change anything! To use this new feature with the parsers, just put quotes around your non-entity trigger (see the Rules Syntax section of the docs).