intfiction.org

The Interactive Fiction Community Forum
It is currently Sun Jul 22, 2018 1:50 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Postures by Emily Short
PostPosted: Sun May 04, 2014 8:02 pm 
Offline

Joined: Tue Mar 18, 2008 9:04 am
Posts: 1115
This topic is for discussions related to Postures by Emily Short


Top
 Profile Send private message  
Reply with quote  
 Post subject: Quick Postures Question
PostPosted: Sun Sep 21, 2014 5:03 pm 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2516
Location: US - Central
I'm using Postures by Emily Short, and I'm having difficulty with "preferred" postures. The documentation seems to be missing a part.

Quote:
Section 1.1: Possible Postures

Each piece of furniture comes with a range of possible postures, which can be expressed with the posture-permission relation: as in


The bunk bed allows seated and reclining.
This definition would say that we're allowed to sit or lie down on the bunk bed, but not to stand up on it. Player attempts to

>STAND ON BUNK BED
will be rejected with

Section 1.2: Preferred Postures

In addition to permitted postures, furniture can have a "preferred" posture: it's possible to stand on a chair, but we're more likely to sit on it. Preferred postures are used to guess what the player means if he types


>GET ON BUNK BED
without naming a posture.


I've tried "step ladder allows seated and standing. step ladder prefers standing" and "...step ladder is usually standing." but the compiler doesn't like either of those. It looks like some of the documentation went missing due to the cut off sentence shown above, so I wonder if this was meant to be taken out?

I even scanned the source of the extension to see if I could find what it wants, but nothing popped out. This isn't critical for my WIP but was curious if I'm missing something.

_________________
http://hanonondricek.wixsite.com/pyramidif
https://pyramidif.itch.io/


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 21, 2014 5:27 pm 
Offline

Joined: Fri Oct 18, 2013 10:13 am
Posts: 2634
Location: The Midwest
You don't need "usually" for a single object. Just say "the step ladder is standing".

_________________
Daniel Stelzer


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Sep 22, 2014 12:46 am 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2516
Location: US - Central
Ah will try that. That must be what got lost in the instructions.

_________________
http://hanonondricek.wixsite.com/pyramidif
https://pyramidif.itch.io/


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Apr 14, 2015 11:26 am 
Offline

Joined: Tue Mar 18, 2008 9:04 am
Posts: 1115
I've tweaked the documentation here and will upload a revised version.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon May 28, 2018 7:23 am 
Offline

Joined: Wed Nov 12, 2014 5:20 pm
Posts: 144
Inspired by this post, I've made a pull request to the Extensions Github repository with an updated version of this extension:

https://github.com/i7/extensions/pull/47

Any comments are very welcome. I'll just copy my thoughts from the PR description here:

I'm not sure what the best way is to handle responses about actions taken by NPC:s. More or less every message printed in the current code is preceded by checking "if the actor is visible," which doesn't seem very elegant and could potentially be slow. In the standard rules, the more common check seems to be "if the actor is the player" and then printing nothing if the actor isn't.

But I think it is nice to get a more detailed response, such as "Clark is already standing on the folding chair," rather than just "Clark is unable to do that," and all those "if the actor is visible" seem to be the simplest way to achieve that without having to write a lot of separate rules just to print basically the same response.

The "convert lying down rule," "convert sitting down rule" and "convert standing up rule" used to end with success or failure, but I've found that if I print a failure message such as "There [are] nothing [here] to sit on," I have to return success, otherwise there will be a second response printed:

Code:
>Clark, sit
There is nothing here to sit on.

Clark is unable to do that.

This means that the rules will now always end in success, which makes all those "rule succeeds" lines a little redundant.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Jun 19, 2018 2:47 pm 
Offline

Joined: Fri Oct 18, 2013 10:13 am
Posts: 2634
Location: The Midwest
One option is to provide unsuccessful attempt rules, which are run in place of report rules when an action taken by an NPC fails. (These are what give the "Clark is unable to do that" messages.) You can check whether "the reason the action failed" matches one of your rules and print a better failure message.

_________________
Daniel Stelzer


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Jun 19, 2018 2:55 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5311
Location: Burlington, VT
Draconis wrote:
One option is to provide unsuccessful attempt rules, which are run in place of report rules when an action taken by an NPC fails. (These are what give the "Clark is unable to do that" messages.) You can check whether "the reason the action failed" matches one of your rules and print a better failure message.


Specifically, they run when an NPC action performed in response to a request fails. An NPC action invoked directly from the source code like "Try Clark sitting" will not invoke unsuccessful attempt rules.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jun 21, 2018 4:51 am 
Offline

Joined: Wed Nov 12, 2014 5:20 pm
Posts: 144
Thanks! Unsuccessful attempt rules do some of what I'm after: they provide a way to give custom responses to failed actions by NPCs. But they will still consist of duplicated code: my attempts to do what you suggested were mostly line-for-line copies of the code that runs when the actor is the player. It seems that it is easy to write "actor-agnostic" responses, but harder to use them without code duplication.

Also, after further investigation, it seems that many if not most extensions pretty much assume that the actor is the player. This actually seems to be true of some parts of the standard rules as well. For example, we have this warning in the documentation, ยง12.4. Persuasion:
Quote:
Note also that "Instead of..." rules written for other people will be treated by Inform as failures, even if we write something like

Instead of Will pulling the cord:
say "The bell rings."

and thus may produce unsatisfactory results such as

>WILL, PULL CORD
The bell rings.

Will is unable to do that.


The example code of the Postures extension also has a bug where asking the NPC to sit or stand on something that the player carries gives an empty non-response:
Quote:
Muddy Lawn
You can see Clark and a folding chair here.

>get chair
Taken.

>clark, sit on chair
>clark, sit on chair
>actions
Actions listing on.

>clark, sit on chair
[asking Clark to try sitting on the folding chair]
[(1) Clark sitting on the folding chair]
[(2) Clark entering the folding chair - silently]
[(3) Clark entering yourself - silently]
[(3) Clark entering yourself - silently - failed the can't enter what's not enterable rule]

[(2) Clark entering the folding chair - silently - failed the implicitly pass through other barriers rule]

[(1) Clark sitting on the folding chair - succeeded]

[asking Clark to try sitting on the folding chair - succeeded]

>

That can be easily fixed by another unsuccessful attempt rule, but what I'm getting at is this: implementing NPCs that can be ordered around is a bit of a rabbit hole. The support in Inform for this out of the box is pretty much a stub. Anyone who wants to make a game with an NPC that can follow instructions will always have to write lots and lots of custom code. Where is it reasonable to draw the line in providing support for this in a general-use extension like this? Well, I guess the obvious answer is: about as much as the original code of this extension did before I touched it. So that is where I should be aiming.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jun 21, 2018 9:16 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5311
Location: Burlington, VT
Angstsmurf wrote:
The "convert lying down rule," "convert sitting down rule" and "convert standing up rule" used to end with success or failure, but I've found that if I print a failure message such as "There [are] nothing [here] to sit on," I have to return success, otherwise there will be a second response printed:

Code:
>Clark, sit
There is nothing here to sit on.

Clark is unable to do that.

This means that the rules will now always end in success, which makes all those "rule succeeds" lines a little redundant.


Maybe one thing to do is set a flag when you print the message that cuts off the unsuccessful attempt rules at the beginning:

Code:
Lab is a room. Clark is a man in Lab.

Instead of an actor smelling: say "[printing failure message]There is nothing to smell here."

Persuasion rule: persuasion succeeds.

Failure message printed is a truth state that varies.

Every turn: now failure message printed is false.

To say printing failure message: now failure message printed is true.

First unsuccessful attempt by someone doing something:
   if failure message printed is true, stop;
   make no decision.


(That last rule took a lot of tweaking to compile--seems like unsuccessful attempt rules need a "by" and action description even if they're totally generic, and they can't take "when" clauses.)


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

All times are UTC - 6 hours [ DST ]


Who is online

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