inform 7: reading an object

The Human is wearing a silver chain. a ID tag is part of the silver chain. ID tag Writing is part of the ID tag.

What is a better way to make the id tag readable?

I’m not sure, but I think the “read” command may trigger the examining action. I often include signs, the text of which is simply embodied as the description. When the player types “read sign,” I’m pretty sure it gives him the description, just as “examine sign” would do.

If you want text on an object to be seen only by the “read” command (and not by “examine”) you may need to do some further tweaking.

Robert Rothman

Yup, this is sufficient if you want to leave read as a synonym for examine, per the standard rules.

The player is wearing a silver chain. A ID tag is part of the silver chain. The description of the ID Tag is "The tag says 'GI Joe'."

I want the text on an object to be seen only by the read command, not by examine.
I tried taking the ID tag writing out and replacing it with Instead of reading the ID tag: say "[if in Skylight room] Modified Human male, Talent: Body Switcher #01[otherwise] It's too dark to read the writing here."

but it won’t accept that

You’re not too far off. Also, I like that you’re now using code tags. It makes things clearer.

As noted above, I7 folds reading into the examining action. This makes sense for some games (maybe a lot of games), but in other games, it could be worthwhile to split reading and examining. I for one often like it if “examine book” tells me the title of the book while “read book” gives me a summary of the contents, but I may be heading off-tangent here so I’ll skip it.

Anyway. The first thing you want to do is split the “read” action (you ‘understand the command as something new’ because you want to use it in a new action). Then, you create the new reading action (I added ‘requiring light’ because reading is hard when you’re in a pitch-black room, unless it’s in braille). Then you add the new Understand phrase, which tells Inform what “read book” actually is supposed to mean.

We still need to make the action do something. All we have right now is an empty command. Therefore, we make it possible for something to be readable or not readable, and for convenience’s sake we create a kind of thing (a ‘written thing’) which is assumed to have text. Each written thing is given the writing property, which is text.

The check rules are there to ensure you don’t read something that isn’t readable; it stops the attempt and issues a warning message. The report rule outputs the contents of the writing property.

The fun part is that now, you can add the “Instead…” rule you mentioned earlier, and it should work without a hitch. That’s because Inform now understands what “reading” means.

Understand the command "read" as something new.
Reading is an action applying to one thing requiring light.
Understand "read [something]" as reading.

A thing can be readable. A thing is usually not readable. 
A written thing is a kind of thing. A written thing is usually readable. 
A written thing has some text called writing. The writing of a written thing is usually "Nothing unusual is written here."

Check reading when the noun is not readable: say "That's not something that can be read." instead.
Report reading: say the writing of the noun.

The Skylight Room is a room.
The Skylight Room is west of the Morgue.

The ID tag is a written thing in the Morgue. The writing of the id tag is "[if in skylight room]'Modified Human Male. Talent: Body Switcher #01.'[otherwise]It's too dark to read the writing here.[end if]"