I don’t know if the source code for Ad Verbum is available, and anyway it’s almost certainly written in Inform 6 (since it came out in 2000 and Inform 7 wasn’t publicly available until 2006). Another recent game based on wordplay is Earl Grey, but that also seems to have been written in Inform 6. Under, in Erebus from this year’s comp was a wordplay-based game that was written in Inform 7, and though I don’t think the source code is available online you could always politely ask the author for it. Oh, and Andrew Plotkin’s “Escape” is a very short wordplay-based game that’s mostly in Inform 7, with publicly available source code here; but the code is a bit harder to read than usual because it had to fit within a 140-character limit for the purposes of a contest.
So that’s not much help for you. One thing about it is that these games have very different sorts of wordplay-based puzzles, and how their implement probably differs accordingly. Escape uses a standard Inform action and implements a couple of synonyms for it (not the one I tried, boo hoo, but it’s impressive that he got any synonyms implemented in a twitter-length IF). Under, in Erebus implements its wordplay through standard actions:
you have to get objects that sound like letters, put them in a row of booths, and push a button, and you’ll get the word they spell out; a bewildering number of words are implemented.
My guess is that somewhere in the source code there’s an enormous table listing all the possible outcomes.
Earl Grey relies mostly on a couple of custom verbs that seem like they must have been really hard to implement. And Ad Verbum has a crazy amount of custom verbs, and some other stuff that I don’t remember too well.
So it really depends on what kind of puzzle you want. Now, if all you want to do is “If the player types in this word, something happens,” that might not be too hard to implement, like this:
[spoiler][code]“A lad in a cave” by Matt Weiner
The Cave is a room. “A bare cave with a door to the north.” Paradise is a room. The magical door is a door. The magical door is scenery. [This means that “You can see a magical door here” won’t show up.] The description of the magical door is “The door has no handles, hinges, or any apparent way of opening it. On it is written: ‘There is a seed that if said will open me.’” The magical door is north of The Cave and south of Paradise. The magical door is closed.
Sesameing is an action applying to nothing. Understand “sesame” as sesameing. [This is the action that will take place when the player types “sesame.”]
Instead of sesameing:
say “With a puff of smoke the door swings open!”;
now the magical door is open.
Instead of opening the magical door:
say “There isn’t any obvious way to open the door.” [We don’t want it to be openable by normal means, but I don’t want to lock it and have the default “It appears to be locked” message appear, so this should work, I hope.]
After going through the magical door:
end the story finally saying “You have won”. [An “instead” rule won’t work here, because that’ll fire before we check to see if you can actually go through the door.]
[The most fiddly bit may be getting the game to understand “say sesame” as well as “sesame.”]
Understand the command “say” as something new. [This is necessary because “say” defaults to the built-in action “answering it that,” I think, and we have to remove that understanding in order to get “say” to do what we want.]
Speaking is an action applying to one topic. [A topic is a piece of text from the command that needn’t be an object that’s present.] Understand “Say [text]” as speaking.
Instead of speaking “sesame”: try sesameing. [This means that “say sesame” does what “sesame” would do.]
[But we need something to happen when the player types “say cheese.”]
Instead of speaking: say “Nothing seems to happen.” [This rule won’t interfere with the previous one because the previous one is more specific.]
[And if the player just says “poppyseed” they’ll get “That’s not a verb I recognise.” That’s bad, so we can include a catchall command to trap any unrecognized command and treat it as a wrong answer to the riddle.]
Wrong-answering is an action applying to one topic. Understand “[text]” as wrong-answering. [In theory this understands any input as wrong-answering, but since the other rules for understanding text are more specific they’ll fire first. That means that, if the command can be understood as anything other than wrong-answering, it will.]
Instead of wrong-answering: say “No, that’s not it.”
[Or, and this probably would’ve been better, I could’ve defined one action to cover both the right answer and the wrong answer.][/code][/spoiler]
It’s more of a riddle than a wordplay, but it’s maybe the same principle.
BTW, I wouldn’t be shy about posting to the I7 forum. I may talk like I know what I’m doing, but I’m basically a noob too. Also, I just look at the unread posts, so I usually don’t even notice which board something is posted in.
[UPDATE: I just walked my wife through the game – she doesn’t play IF, but she did get the puzzle – and her reaction was “you scored 0 out of a possible 0?” So the moral is, turn off scoring if you don’t use it.]