For all you vets, this may sound stupid, but if I were to make a readable object like a leaflet, how to I tell the program to differentiate between look/examine and read? I can’t find where this is explicitly explained in the docs, which may just be because I’m blind, but i’m having troubles. I specified that “Leaflet is an object. Leaflet can be read.” I don’t know where to go from there.
Hello and welcome!
There’s an example in the documentation about how to do this, example 292 “The Trouble With Printing.” (I can’t get that link to expand automatically; if you’re having trouble with it, the number 292 should be a link to expand/collapse it.)
Here’s the code:
[code]“The Trouble with Printing”
A thing has some text called printing. The printing of a thing is usually “blank”.
Understand the command “read” as something new. Understand “read [something]” as reading. Reading is an action applying to one thing, requiring light. Check reading: if the printing of the noun is “blank”, say “Nothing is written on [the noun].” instead. Carry out reading: say “You read: [printing of the noun][line break]”. Report reading: do nothing.
The Archive is a room.
Berkeley’s report is a thing in the Archive. The description is “A report from Governor Sir William Berkeley of Virginia, in 1671, in answer to the queries sent by the Commissioners of Plantations the year previous. Of this report the better part is burned and only a tail fragment remains.” The printing of Berkeley’s report is “I thank God, [italic type]there are no free schools[roman type] nor [italic type]printing[roman type], and I hope we shall not have these hundred years; for [italic type]learning[roman type] has brought disobedience, and heresy, and sects into the world, and [italic type]printing[roman type] has divulged them…”
Test me with “examine report / read report”.[/code]
Breaking down the parts of it:
In the standard rules, the command “read” is a synonym for the command “examine.” The line
Understand the command "read" as something new.
eliminates all the existing grammar for “read,” so we can redefine it.
Then we need a reading action. “Reading is an action…” defines the action, and
Understand "read [something]" as reading.
lets the “read” command be understood as our new action.
Then there are rules for the action. The property “printing” is used to keep track of what you get when you read something, and also whether it makes sense to read it at all. Then the other rules handle the reading action itself.
Hope this is helpful!