intfiction.org

The Interactive Fiction Community Forum
It is currently Tue Aug 21, 2018 10:59 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: unexpected response
PostPosted: Mon Feb 12, 2018 2:03 pm 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 177
Location: Michigan
IFaddicted wrote:
Okay, it works if I include it in the rule specific to the swivel chair, but not if I try to make it a general rule(as I feared).

Of course, none of this is crucial(if I don't correct it), but I think it may put off players a bit.


The specific rule likely overrides the general rule. Maybe it's a good time to see if you can generalize some of your specific rules?

_________________
~~~
My ebooks on Amazon
My ebooks on Smashwords


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: unexpected response
PostPosted: Mon Feb 12, 2018 2:14 pm 
Offline

Joined: Sat May 07, 2016 5:57 pm
Posts: 363
Location: Hot Springs, Arkansas
Okay, I will probably have to eliminate the specific rules for each supporter, for the general rule to work, right?

Thanks


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: unexpected response
PostPosted: Mon Feb 12, 2018 2:15 pm 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 177
Location: Michigan
Eliminate or modify.

I mean, I'm still a relative newbie to inform. Zarf might still show up with an elegant solution.

_________________
~~~
My ebooks on Amazon
My ebooks on Smashwords


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: unexpected response
PostPosted: Mon Feb 12, 2018 2:53 pm 
Offline

Joined: Mon Dec 15, 2014 9:15 am
Posts: 340
Smelling and listening (to) are rather strange verbs. Their definition in the Standard Rules uses peculiar (and undocumented) syntax,
"Smelling is an action applying to nothing or to one thing". It isn't clear, to me at least, just what this means.

But if the player doesn't provide a noun, one is provided by default anyway, so the verb is never really treated as intransitive. This default, slightly weirdly, is the "the touchability ceiling" (which is defined by a routine---it usually turns out to be the location, but your case is complicated.)

What's going on is that Inform is applying your access rule to determine the touchability ceiling, and printing its message in the process. Then, having failed to reach outside the chair, it has decided that the touchability ceiling is the chair. So it processes the action "smell chair", and prints the standard response for that too.


You get this double response even with the Standard Rules.
Code:
Crypt is a room. The sarcophagus is a closed container in Crypt. The player is in the sarcophagus.

Quote:
Darkness
It is pitch dark, and you can't see a thing.

>smell
The sarcophagus isn't open.

You smell nothing unexpected.

>


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: unexpected response
PostPosted: Mon Feb 12, 2018 8:45 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5321
Location: Burlington, VT
ON POSTING: Looks like jrb came in with a better explanation of what's going on with the touchability ceiling while I was typing! One thing that helps here is to type "actions" before typing the command that you're testing--this shows the action that is actually getting processed.

The smelling action and listening actions are a bit of a weird special case. They take one noun so they aren't really intransitive.* But the player can also type "smell" or "listen" by themselves, so those commands have to be understood too. The Standard Rules take care of this with a rule for supplying a missing noun:

Code:
Rule for supplying a missing noun while an actor smelling (this is the ambient odour rule):
   now the noun is the touchability ceiling of the player.

Rule for supplying a missing noun while an actor listening (this is the ambient sound rule):
   now the noun is the touchability ceiling of the player.


So if you type "listen" or "smell" by itself, the action will be converted into an action on "the touchability ceiling of the player," which is almost always the room the player is in. (If the player is in a closed container, that's the touchability ceiling, I think.) That's why the action is smelling the Writer's Office. "Instead of smelling" doesn't do anything different because it's functionally the same as "Instead of smelling something"--the noun is still the Writer's Office, so the reaching outside rules get checked for it.

The problem you're having with specific and general rules concerns rule order, I think. If I try combining a rule for containers/supporters with a rule for the swivel chair, like this:

Code:
A rule for reaching outside of a supporter:
   if smelling:
      allow access;
   if listening:
      allow access.

The swivel chair is a vehicle.

Rule for printing room description details of the swivel chair:
   do nothing instead.

A rule for reaching outside of the swivel chair:
   if the noun is John Diddling:
      allow access;
    if smelling:
      allow access;
   otherwise:
       say "You'll have to get off your lazy butt.";
       deny access.

The Writer's Office is a room. The swivel chair is here. The player is here.

The bullpen is north of the Writer's Office. "Nice place. Mr. Jones keeps it that way."

John Diddling is a man in the Writer's Office. "Stocky".

Instead of smelling the Writer's Office:
   say "Stinks."
   
Instead of smelling the bullpen:
   say "Smells nice. Mr. Jones, the secretary, keeps it better than you keep your office."


then, if I look up the reaching outside rules in the Rules tab of the index, it shows that the rule for reaching outside the swivel chair runs before the rule for reaching outside a supporter, because the swivel chair is more specific than "a supporter." You can flip this around by changing your general rule:

Code:
A rule for reaching outside of a supporter when smelling or listening:
   allow access.


This now shows up as more specific than the rule for reaching outside the swivel chair, because a rule with a "when" clause counts as more specific than a rule without one. So if you try sitting in the chair and smelling, you'll get your message. (In cases where you want one rule to run first and you can't tweak it like this, you can just write "First rule for reaching outside..." and that will make it run first.)

*Actually in the latest version of Inform both these actions are defined as "applying to nothing or one thing." This appears to be something that only Graham Nelson understands.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: unexpected response
PostPosted: Tue Feb 13, 2018 2:43 am 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 177
Location: Michigan
Pretty sure "applying to nothing" means you don't have to specify anything when smelling. That's why you can

> smell

and get the smell of where you are rather than having to type

> smell writer's office

_________________
~~~
My ebooks on Amazon
My ebooks on Smashwords


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: unexpected response
PostPosted: Tue Feb 13, 2018 5:51 am 
Offline

Joined: Mon Dec 15, 2014 9:15 am
Posts: 340
It's not as straightforward as that. It's always possible to associate commands with actions with fewer than the required number of nouns. The missing nouns can be added by "supplying a missing noun" rules. E.g.
Code:
Foo room is a room.
Fooing is an action applying to one thing. Understand "foo" as fooing.
Rule for supplying a missing noun when fooing: now the noun is the location.
 
Instead of fooing the location: try jumping.

Quote:
Foo room

>foo
You jump on the spot.

>


(In the case of listening, the "ambient sound rule" supplies the missing noun. Incidentally, this rule is mentioned in the documentation, Section 18.32, but is stated quite incorrectly there.)


The "applying to nothing or one thing" formulation lets you write instructions like "try fooing" in your source text without having to specify the noun. This wouldn't compile otherwise ("too vague to describe a specific action").

The listening to action has a further undocumented property, "abbreviable", which lets you write "try listening" as shorthand for "try listening to". (And also e.g. "Instead of listening" for "Instead of listening to".)

I don't know whether there's any more to it than that; probably not I guess.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: unexpected response
PostPosted: Tue Feb 13, 2018 9:46 am 
Offline

Joined: Sat May 07, 2016 5:57 pm
Posts: 363
Location: Hot Springs, Arkansas
Thank you all for your help! Seems like I am learning something new about Inform7 all the time.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: unexpected response
PostPosted: Tue Feb 13, 2018 10:11 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5718
I prefer to avoid the supplying-a-missing-noun mechanism entirely. I always create separate actions for noun and nounless grammar ("fooing something" and "vague-fooing"). Then I write vague-fooing rules that select an object, if possible, followed by "instead try fooing X".

I'm not saying it's The Right Way, but it works fine and it lets me ignore one source of confusion.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: unexpected response
PostPosted: Tue Feb 13, 2018 12:16 pm 
Offline

Joined: Sat May 07, 2016 5:57 pm
Posts: 363
Location: Hot Springs, Arkansas
Zarf, that's what I usually do, thank you for the confirmation.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 12 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