Forcing room descriptions

I have the following code…

After going to room1:
	if the button1 is switched on:
		say "You hear a loud crash in the distance!";

My problem is with the room descriptions. If I add “continue the action;” to the end, the room description comes last. But I want the room description of come first. If I add “try looking;” as the first action in the sequence, I will break the brief/verbose model.

I want my output to look as follows. It there a “good” way of doing this?


Nothing special about this simple room.
You see a letter here.
You hear a loud crash in the distance!

BRIEF mode (not first visit to room):

You see a letter here.
You hear a loud crash in the distance!

Thanks in advance,

[code]“test” by Hanon Ondricek

Example Location is a room. “Hello, here’s an example location.”

Room1 is west of example location. “Here is Room1.”

A flower is in room1.

a machine is a device in Example location.

Report looking in room1 when machine is switched on:
say “[one of]You hear a loud crash in the distance![or][run paragraph on][stopping]”[/code]

How about this?

Last report going to room1 when the button1 is switched on: say "You hear a loud crash in the distance!"

The “describe room gone into” rule, which is the one that prints the room description, is a Report going rule–that’s why the After rule runs (and prints its output) first. So if we write another Report going rule, and force it to the end of the rulebook, it should work.

(Hanon, I don’t think he wants to hook it to the looking action in case the player is using brief mode–though honestly, you could always just turn off brief mode, which has fallen out of favor I think… actually, if I read Appendix A aright the message should still appear in brief mode. But! You don’t want it to appear when the player looks in room1, only when they go to room1, so best to hook it to going rather than looking. This is related to the general precept that you shouldn’t describe actions in room descriptions, I guess–that is, your room description shouldn’t say “As you walk into the foo room…” because it’ll look silly when the player does a LOOK command.)

[EDIT AGAIN]: Oh, I see–Hanon, your “one of/stopping” prevents the message from printing a second time. So the question is, do you want the message to print any time the player goes into room1 with the button switched on, or just the first time? If any time, then I think it’ll work better to use a Last Report rule the way I did. If just the first time, then hooking it into looking and switching off the message should work.

Huh, I plumped for:

[code]Button1 can be noise-making. Button1 is noise-making.

Report looking when the location of the player is room 1:
if button1 is noise-making and button1 is switched on:
say “You hear a loud crash in the distance!”;
now button1 is not noise-making.[/code]

But Hanon’s solution is more elegant.

I don’t think brief and superbrief override looking, I think it just mutes the room description.

Yeah, I edited that in (sorry, I was crossposting and saw yours on preview, so I edited somewhat hastily). The difference isn’t between brief or superbrief, it’s what happens if you leave Room1 and exit it again. On your solution I don’t think the message will print again, on mine it will.

I would still tend to think that if you really want the message to be hooked to going rather than looking, it’s better to find a way to make it a going rule and get it to print in the right place, if possible–it might work better in some edge cases.

I think that’s the problem he originally had - the “going” happens before the “looking”, and he wanted the message to print after the room description.

But the “looking”* happens in a Report going rule (describe room gone into). So printing the text in a Last report going rule should work, I think.

*Actually it’s a weird thing that runs the check/report/carry out looking rules but not before, instead, or after, per Appendix A.

Thanks for all the replies. I learned something new from each one.

I start my game in verbose mode but was concerned about players changing to brief mode on their own.

I want the message to print every time the player enters the room if the button had been pressed. All of these solutions seem reasonable. I went with “last report going” because it makes more sense for my situation. The noise event is tied into the act of arriving in the room, not necessarily looking, so it “fits” better for me. I coded this and it works as expected in brief and verbose modes.

Again, thanks to all the experienced developers for replying. You guys are awesome! I still have a lot to learn. I think I will start by reviewing chapter 18 on rules again. Is they any other documentation I should be reading besides the builtin docs?