Look up something in a book

Hey all,

Sorry for the zillion questions.

I’d like to have a book that the player can look things up in. Obviously, I want “Look up wildbird” to mean look him up in the book, and not “look at wildbird” or “examine wildbird.”

This doesn’t work:
Instead of looking up wildbird: [or look uping wildbird or lookuping wildbird]
if the player is carrying guidebook
say “the wildbird is a purple bird native to North America.”;
say “You dont have the guidebook”
end if.

I’ll be allowing the player to look up several things, so I need to be able to give different transitive objects.


That doesn’t work because Inform doesn’t have a default “look up [text]” action, only “look up [text] in [something]”.

This is probably the best way to do it:

[code]Section - Briefly Consulting About

Briefly consulting about is an action applying to one topic.
Understand “look up [text]” or “read about [text]” or “read [text]” as briefly consulting about.

Check briefly consulting about:
if the player cannot see the guidebook,
say “You don’t have the guidebook.” instead.

Carry out briefly consulting about:
try consulting the guidebook about the topic understood instead.

Section - Entries in the Guidebook

[the default for looking up unlisted topics]
Instead of consulting the guidebook about:
say “The guidebook seems not to have an entry on that topic.”

Instead of consulting the guidebook about “wildbird”:
say “The wildbird is a purple bird native to North America.”[/code]

This way, both LOOK UP WILDBIRD and LOOK UP WILDBIRD IN GUIDEBOOK will work without you having to write two sets of rules doing the same thing. To add an entry to the guidebook, just add another rule like:

Instead of consulting the guidebook about "whatever": say "Blah blah blah."

If you want the player to be holding the guidebook before looking something up (as opposed to it being on the ground or on a table or something like that):

Before consulting the guidebook about: if the player does not have the guidebook: say "(first taking the guidebook)[command clarification break]"; silently try taking the guidebook; if the player does not have the guidebook: stop the action.

Check out example 90 in the manual (http://www.inform-fiction.org/I7/ex94.html#e94), it should be pretty much just what you need (it’s even about birds!)

I didn’t even know there was a “look up [text] in [something]” verb. I’m reading the manual but I hadn’t gotten there yet.

This is a huge help. Thanks so much to both of you.