Simple (I hope) problem with Postures / Modified Exit

I’m probably being daft here.

I’m using Emily Short’s postures, which is incredibly helpful, but disallows leaving a room by typing OUT. Modified Exit, also by Emily, seems partly designed to fix this, but it doesn’t work for me. Sorry if I’m missing something really obvious.

Example non-working code:

Include Postures by Emily Short. Include Modified Exit by Emily Short. Field is a room. House is a room. Inside from Field is House. Outside from House is Field.

Thanks for reading!

I can tell you how to fix it, but I’m an I7 duffer, so I can’t tell you whether my fix creates undesired side effects.

Open Postures. In Section 9, add an if-clause, like this, and save the extension:

[code]Section 9 - Convert Exits when sitting or lying in a room

Check an actor exiting when the holder of the actor is a room (this is the convert exits to standing rule):
if the actor is not standing:
try the actor taking position standing instead.[/code]
This may qualify as a bug in Postures … I don’t know. Seems to me it ought to have said that from the beginning, but maybe there are reasons why the cure is worse than the disease. At any rate, you can now use ‘out’ in the House and you’ll find yourself back in the Field.

Oh, and by the way – I found the offending rule by running your test game and using the ‘rules’ command before trying ‘in’ and then ‘out’. Useful command, ‘rules’. It often reveals the source of naughty behavior.

It’s generally a bad idea to edit an extension as it could cause compatibility issues. It’s much better to replace the section in the source code, like so.

[code]“Test”

Include Postures by Emily Short.

Section 1 - Convert Exits Fixed (in place of Section 9 - Convert Exits when sitting or lying in a room in Postures by Emily Short)

Check an actor exiting when the holder of the actor is a room and the actor is not standing (this is the convert exits to standing rule): try the actor taking position standing instead.

Section 2 - Game Code

The Field is A Room. The House is inside from The Field.[/code]

This fix won’t create undesired side effects because it reduces the scope of the rule. Any errors caused by this fixed version will be present in the unmodified version.

Hope this helps.

Also, Modified Exit is completely independent this error. The problem is solely with Postures.

The convert exits to standing rule is the sole content of section 9 of the extension. I not sure what the purpose of the rule is. What it does is this: if the player tries the commands EXIT, LEAVE, or OUT while s/he is not in anything, the game will respond “You are now standing.” or “You are already standing.”, rather than letting the player walk out of the room (if there is an exit out) or answer “But you aren’t in anything at the moment.” (if there isn’t).

Perhaps this is a good thing (e.g. to allow the author to intervene to say that the player for some reason cannot stand up, if s/he is sitting or lying down). But is there any reason to stop the action automatically after standing up? I guess a good bug fix might be just to delete the trailing “instead” in the convert exits to standing rule. And preferably, I think, it should try taking position standing silently, but for some reason (that I can’t figure out) that doesn’t seem to work.

All you need to do is unlist the rule. Try this.

[code]“Test”

Include Postures by Emily Short.

The convert exits to standing rule is not listed in the check exiting rulebook.

The Field is A Room. The House is inside from The Field.

Test me with “in / sit down / out / in / lie down / out”.[/code]

In fact, this pretty much fixes everything.

Hope this helps.

It looks like that rule was intended to cover “stand” and “stand up”, and spilled over to “exit” unintentionally. (They’re all the “exiting” action.)

Thanks to everyone for the help on this one. I’ve gone with climbingstars suggestion, which seems to be causing no issues.

Ack - I spoke too soon. Having removed the rule, if the player sits down in a room (not on something, just in the room itself) they cannot stand up! To clarify, they can leave the room (first standing up), but the command ‘stand’ returns ‘There’s nothing to stand on.’ which should be ‘You are now standing.’

Also (sorry, still very new to I7), how can I tell which rulebook an extension’s rule is listed in? Looking at the extension source, I can find the convert exits to standing rule, but no mention of the check exiting rulebook.

The heading of the rule tells you that. It’s in the check exiting rulebook because the rule begins “Check an actor exiting…”

Dang! I missed that one! You might want to try out my first solution or something like this.

[code]“Test”

Include Postures by Emily Short.

Check an actor exiting when the holder of the actor is a room and the actor is not standing (this is the new convert exits to standing rule): try the actor taking position standing instead.

The new convert exits to standing rule is listed instead of the convert exits to standing rule in the check exiting rulebook.

The Field is A Room. The House is inside from The Field.[/code]

Hope this helps.

That makes a lot of sense. Thanks!

I’m afraid that doesn’t fix the problem:

sit
You are now seated.

stand
There’s nothing to stand on.

That problem is due to another rule (as you can see by playing your game after typing the debug command RULES), viz. the convert standing up rule (also in Postures).

I suggest this for bug fixes:

[code]
Check an actor exiting when the holder of the actor is a room (this is the amended convert exits to standing rule):
if the actor is not standing:
try the actor taking position standing [instead].

The amended convert exits to standing rule is listed instead of the convert exits to standing rule in the check exiting rulebook.

Instead of an actor standing up (this is the amended convert standing up rule):
if (the holder of the actor is a thing and the holder of the actor allows standing) or the holder of the actor is a posture-friendly room:
try the actor taking position standing;
if the posture of the actor is standing:
rule succeeds;
rule fails;
otherwise if the holder of the actor is not the location:
let the source be the holder of the actor;
try the actor exiting;
if the holder of the actor is the source:
rule fails;
rule succeeds;
otherwise:
if the player is the actor:
if the holder of the actor is a thing:
say “You can’t stand on [the holder of the actor].”;
otherwise:
say “There is nothing to stand on.”;
rule fails.

The amended convert standing up rule is listed instead of the convert standing up rule in the instead rulebook.
[/code]What I’ve done is 1) edited out the “instead” in the check rule, which will make the exiting action continue after the player has risen (when the player is in a room), 2) added a condition to make the convert standing up rule to recognize posture-friendly rooms, 3) in the convert standing up rule, changed the obviously wrong response “You can’t lie down on …” to “You can’t stand on …”.

A tidy fix, Felix, and many thanks to you. This seems to solve everything.

:smiley:

Felix, this code seems to break the Postures test example (“Muddy Lawn”). Specifically, step 31 of the “test me” sequence:

Driveway

>[29] drop chair
Dropped.

>[30] sit down
You are now seated.

>[31] get up
You are now standing.

But you aren't in anything at the moment.

>[32] sit on chair
You are now seated on the folding chair.

Right. This should do it. (It’s about the same way it’s done in the Standard Rules.)[code]
Check an actor exiting when the holder of the actor is a room (called the local room) (this is the amended convert exits to standing rule):
if the actor is not standing:
try the actor taking position standing;
if the room-or-door outside from the local room is not nothing:
instead try the actor going outside;
stop the action.

The amended convert exits to standing rule is listed instead of the convert exits to standing rule in the check exiting rulebook.

[The below code is unchanged from my previous post:]

Instead of an actor standing up (this is the amended convert standing up rule):
if (the holder of the actor is a thing and the holder of the actor allows standing) or the holder of the actor is a posture-friendly room:
try the actor taking position standing;
if the posture of the actor is standing:
rule succeeds;
rule fails;
otherwise if the holder of the actor is not the location:
let the source be the holder of the actor;
try the actor exiting;
if the holder of the actor is the source:
rule fails;
rule succeeds;
otherwise:
if the player is the actor:
if the holder of the actor is a thing:
say “You can’t stand on [the holder of the actor].”;
otherwise:
say “There is nothing to stand on.”;
rule fails.

The amended convert standing up rule is listed instead of the convert standing up rule in the instead rulebook.[/code]