Non-furniture posture description after room name?

Firstly, apologies for the clumsy thread title.

Inform helpfully suffixes room names with the player’s supporter position, as in:

Forbidden Glen (on the pointy toadstool)

How can I have the game display (on the floor) after the room name when the player sits or lies down in the room itself, rather than on a supporter?

Thanks for reading.

Well, you probably want to modify the “room description heading rule” from the Standard Rules so that it prints that thing when you need. Here’s the rule:

Carry out looking (this is the room description heading rule): say bold type; if the visibility level count is 0: begin the printing the name of a dark room activity; if handling the printing the name of a dark room activity, issue miscellaneous library message number 71; end the printing the name of a dark room activity; otherwise if the visibility ceiling is the location: say "[visibility ceiling]"; otherwise: say "[The visibility ceiling]"; say roman type; let intermediate level be the visibility-holder of the actor; repeat with intermediate level count running from 2 to the visibility level count: issue library message looking action number 8 for the intermediate level; let the intermediate level be the visibility-holder of the intermediate level; say line break; say run paragraph on with special look spacing.

The first thing I’d do is give every room a floor-text so you have something to print (you might not want to hardcode “on the floor” because it’d be better to say “on the ground” when you’re in the Forbidden Glen). Then I guess I’d add something to print the floor-text just before that line break; but you only want it to do so if it’s printed the room name and it hasn’t printed anything else after it.

The way I would handle this, personally, and it might not be the best way, is I’d set a flag at the very beginning of the rule that tells us whether we ought to print our “(on the floor)” text – something like “Now need to print the floor name is true”. (You also have to declare “Need to print the floor name is a truth state that varies.”) Then, I’d unset the flag (“Now need to print the floor name is false”) if we’re in darkness (in the bit where the printing the name of a dark room activity runs) or inside a container that we can’t see out of (this is the part where it says “[The visibility ceiling]” instead of “[visibility ceiling]”) or if we’ve just printed “(on the pointy toadstool)” (this is part of the loop where you issue library message number 8). If you get to the end of the rule, check if the flag is still set and if it is print the floor-text of the location.

And you have to put this all in a Carry out looking rule called “the new room description heading rule” or something like that and say “The new room description heading rule is listed instead of the room description heading rule in the carry out looking rulebook.”

Hope this is helpful! I haven’t even tried to write it up let alone test it but with luck it points the way. There may be better ways to do it!

I really appreciate the advice, and it definitely looks helpful, but also sadly a little (read: a lot) out of my depth. I’m genuinely not asking anyone to write the full code for me, though if there is a simpler workaround that would be great. And if it’s any consolation, the above code has helped me figure out a couple of other things. Thanks!

What about the floor as a supporter-scenery or backdrop?

Sorry, I guess I was not being too helpful. The rule I posted is the code in the Standard Rules that prints the room name and the little postures thingy, so you don’t need to know how it does what it does; just where in the rule you would want to put your code for saying “(on the floor)” or whatever.

Maybe it would help if I annotate it? The idea is that you want to print “on the floor” if you haven’t printed anything else besides the room name.

Carry out looking (this is the room description heading rule): say bold type; if the visibility level count is 0: [This means you're in darkness] begin the printing the name of a dark room activity; if handling the printing the name of a dark room activity, issue miscellaneous library message number 71; end the printing the name of a dark room activity; [here you've printed "Darkness" or whatever you print when you can't see the room] otherwise if the visibility ceiling is the location: [This is the normal case: you can see the room you're in] say "[visibility ceiling]"; [And this is just what prints the room name] otherwise: [This will happen when you're in an opaque closed lit container or something -- you can see, but you can't see the room] say "[The visibility ceiling]"; [This will print "The coffin" or something like that instead of the room name, if you're in a lighted coffin] say roman type; let intermediate level be the visibility-holder of the actor; [the "visibility-holder" of the actor is the thing you're on/in] repeat with intermediate level count running from 2 to the visibility level count: [this is the tricky part, but the visibility level count is the number of stacked levels of things holding you that you can see. If you're on something that's in something that's on something that's on the floor, that's four levels of visibility, if you can see them all. And if you're just on the floor, that's one level of visibility -- which means this loop doesn't run at all, because it's a loop from 2 to 1] issue library message looking action number 8 for the intermediate level; [this is where it prints "(on the mushroom)" or whatever] let the intermediate level be the visibility-holder of the intermediate level; [and before this line is where you'd want to say "(on the floor)"] say line break; say run paragraph on with special look spacing.

OK, so the thing is, if you reach the bottom without having printed any funny stuff, you print “(on the floor)”. There are three places where funny stuff might get printed: the part whrere it prints “Darkness,” the part where it prints “The Coffin,” and the part where it prints “(on the mushroom)”.

My suggestion is that you use a global variable (“a truth state that varies”) to keep track of whether funny stuff has been printed. You could call it “funny stuff printed” if you want. At the very beginning of the rule you have to set it to false. Then in the three places where funny stuff gets printed, you toss in a line setting it to true. At the end of the rule you check whether it’s true; if it isn’t, that’s where you print “on the floor”.

The other suggestion was that you come up with something that lets you change whether it says “on the floor” or “on the ground” or something else depending what room you’re in, but you might want to get the simple version up and running first.

OK, if you’ve figured out what you need to put in this code, you’ve got a new rule. Then you have to put in place of the old rule, so it runs and the old rule doesn’t. That’s what you do by changing the name of the rule to the “new room description heading rule” and saying “The new room description heading rule is listed instead of the room description heading rule in the carry out looking rulebook.” That’ll put the new rule in and take the old one out, and the new rule will go in the right place so the new heading appears on top.

So it’s a matter of taking an existing rule, tweaking it, and popping the tweaked version back in. Something that’s really useful for this standard rule-tweaking business is Appendix A, which is an annotated version of the standard rules. You can find it on the Inform7 homepage under “Sources > Webs” under “Browse the SR Web extract here” (which is something that you wouldn’t look at if you didn’t know what was there, alas).

Hope this has actually been helpful this time!

Okay, that looks perfect! I really, truly appreciate the hard work. Right now I’ve coded myself into another corner, but this is high up my to do list, and I’ll let you know soon how I get on. Thanks!