Changing default responses to library verbs?

I’m sure the information is out there somewhere, but how does one change the deafult responses to the library verbs without using “before” everywhere? I know how to extend verb/noun/preposition combinations but I don’t know how to access the default verb subroutines. I would prefer not to have to edit the libary files themselves, but I don’t know what else to do. Thanks!

Do you know about LibraryMessages?

(Not meant to be snarky; there are some things that LibraryMessages can’t do)

Snark away!

No, I did not know about LibraryMessages but by doing an online search I found out about the Replace command in section 25 of the DM4, though I’m a little unclear on where things are actually placed in the source code in order to use it. Seems like a workable solution, though.

However, if there’s a way just to replace messages, that would work too. Of course, I’d have to know which library messages are applied to which verbs, I think. Not sure where to find that either.

The intended mechanism for doing this is in DM4 §25. Basically, you define an object called LibraryMessages after including Parser but before including VerbLib. Once you’ve done this, the object’s before routine will be called every time the library wants to print a message, with the global variables lm_n (“library message number”) and lm_o (“library message object”) set to the appropriate parameters. If it returns true, the library won’t print its own message.

Appendix 4 has the full list of message numbers.


@Draconis is right, but perhaps an example would help:

Object LibraryMessages
      if (lm_n == 2)
        "There's no score in this game. Your only goal is to get home out of the acid rain.";
      "You had a sleep earlier, remember? That's how you got into this predicament.";

Note that Appendix 4 is way out of date. To see the latest, look for LanguageLM in the english.h library file.

Also note that it’s completely different if using the PunyInform library.


Thanks, guys. I hastily skimmed over the DM4 section and didn’t realize it was right in front of me. Gotta work on my patience and just read stuff thoroughly.

Still, gotta love the DM4. Pretty much everything is in there, but it’s so hard to find. In cases like these, even when you know what you’re looking for it’s hard to know what, specifically, to look up.

Fortunately, there are all of the wonderful people of this forum to help out. Thanks again!

1 Like

It’s also unfortunately rather out of date now, as Garry pointed out.

And, ironically, there’s a section devoted to altering library responses in the third sample game (“Captain Fate”) in The Inform Beginner’s Guide, listed in the pinned resources of this forum. I had just worked through the first and second game (“Heidi” and “William Tell”) and was trying to experiment with stuff on my own rather than finishing off the Guide. But it was all there.

Of course, I had gone through the Guide months ago but forgot 75% of it. So there’s that. Guess I should actually start making my own games soon if I want stuff to stick.

1 Like

well, capitain Fate’s narrative style was annoying even prior of 2016, so many people, incl. me browse IBG as quick reference & recipebook up to William Tell (this also help avoiding forgetting what was read…)

IMHO, a new edition with much less uppercase in the third part will be very warmly welcome.

Best regards from Italy,
dott. Piergiorgio.