So I don’t have an ELI5 tutorial, but here would be my elevator pitch. Here’s some code from Familiar Problems; the goal is to determine which rooms have currently solvable puzzles in them (that is, puzzles you can solve with your current abilities and inventory, without needing anything else), in order to highlight them on the minimap.
First, we want to determine whether a particular puzzle depends on another.
($Child depends on $Parent)
*($Child requires $Parent)
($Child depends on $Parent)
*($Child requires $Intermediate)
($Intermediate depends on $Parent)
We define that $Child depends on $Parent if $Child requires $Parent, or, if $Child requires $Intermediate, and $Intermediate depends on $Parent. Note the recursive definition here—almost everything in Dialog is recursive in one way or another.
Also note that it’s not a problem that we never specify what $Intermediate will be. We don’t have to explicitly loop over all the options; all that matters is that there exists some $Intermediate that makes all these queries succeed.
($Puzzle is missing dependencies)
*($Puzzle depends on $Other)
~(solved $Other)
We say $Puzzle is missing dependencies if it depends on some $Other, and $Other is not solved. Again, we don’t have to explicitly specify what $Other is; Dialog will take care of figuring out if there exists any $Other that will make these queries succeed.
And now, in our game code, we can just specify:
(puzzle #glasscase)
(solved #glasscase)
(#glasscase is open)
(#glasscase requires #f-resonate)
The glass case is a puzzle, it’s solved if it is open, and it requires #f-resonate
. (Dollar signs mark variables; hash signs mark objects. The third sigil is the at sign, for dictionary words. Quotation marks have no special significance.) Dialog can now determine that, since the skeleton requires the animation familiar, and the animation familiar requires the glass case, the skeleton depends on the glass case. The glass case is solved if it is open. So if the glass case is not open, then the skeleton is missing dependencies, and is not currently solvable. So the skeleton should not be highlighted on the map.