intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Sep 22, 2018 1:18 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Aug 19, 2018 3:26 pm 
Offline

Joined: Sun Aug 19, 2018 3:04 pm
Posts: 19
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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Aug 20, 2018 10:17 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5360
Location: Burlington, VT
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".


Breaking down the parts of it:

In the standard rules, the command "read" is a synonym for the command "examine." The line

Code:
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
Code:
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!


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group