Change room descriptions, when player is in a certain state

I was hoping the kind people of intfiction would help again:-)

I am working on a simple madness mechanism, basicly the player can be sane or insane, eat a pill and become sane again.
Now, I would like the room descriptions to change, when the players enter insane mode(:slight_smile: ), but I cant anything about dynamically change the room descriptions.

Do you know how?

The easy way is the [if-else] in the description. I can’t write much with the iPhone. Will post a code in one hour.

There you go. This is tested.

[code]“Insanity” by Marco Innocenti.

A person can be sane or insane. A person is usually sane.

The garden is a room. “You are in your garden[if the player is sane]. Giant moths fight against pink elephants. You can’t tell who will win[else]. There is nothing uncommon here[end if].”

After looking for the first time:
now the player is insane.

Test me with “look”[/code]
Note: in this example the mere act of looking changes the status of the player. It can be anything you want.

You might also want to check out the “Ant-Sensitive Sunglasses” example from the documentation, which walks through a few different ways to do almost exactly this.

Thanks the both of you:-)

It worked perfectly and the documentation provided some insight on the flexibility of inform7.

First post here at intfiction, and my first attempt at interactive fiction. I think my problem is close enough to this one that I figured I should just continue this thread. Hoping someone can give me a point in the right direction here.

So, my first room is a laboratory. I want my character to start the game with their head in their hands, so that the initial room description provides no visual information. I then want the player to observe his surroundings after typing their first “look” command. I’ve gotten close, but there are problems, and beyond that, I expect I’m doing this in an inefficient manner anyway.

[code]A room can be visible or invisible. A room is usually visible.

Laboratory is a room. Laboratory is invisible. “You’re sitting at a desk with your head in your hands. Your heart is racing, and there is a faint scent of ozone in the air[if Laboratory is visible]. You lift your head from your hands with a sigh and examine your surroundings. Papers and books are strewn all about you, along with various scientific instruments. There is a large machine in the corner[else][end if].”

After looking for the first time:
now Laboratory is visible.[/code]

This sort of works, and runs like so:

I want to eliminate the “you’re sitting…heart is racing…” sentences from the second description. What’s the best way for me to do this/can I do this? Can I also give the Laboratory a different name before the look command, or just remove the first instance of the name entirely? I apologize if I’ve overlooked some simple process in the various documents and tutorials. I swear I’ve looked through many of them.

Try changing your ifs and elses:

"[if Laboratory is visible]You're sitting at a desk with your head in your hands. Your heart is racing, and there is a faint scent of ozone in the air.[else]You lift your head from your hands with a sigh and examine your surroundings. Papers and books are strewn all about you, along with various scientific instruments. There is a large machine in the corner.[end if]"

I suspect you don’t need the “end if”. In your original code, I don’t think the “else” is doing anything – it looks like it should compile even without the “else.”

HOWEVER: You should avoid describing actions in the room description, as with “You lift your head from your hands with a sigh and examine your surroundings.” As written, that will print every time the player looks in the Laboratory, and it really should only print the first time. You should put that bit of prose in a special rule, perhaps:

Before looking for the first time: say "You lift your head from your hands with a sigh and examine your surroundings. [run paragraph on]

“run paragraph on” is meant to prevent Inform from putting in a line break there.

This may still be rather inefficient, but if you fiddle around with things like this I think you’ll be able to do what you want.

For the Laboratory thing, you might want to look in changing the printed name of the room appropriately. You could also try messing with the room description heading rule in the Standard Rules, but that might be a bit advanced at the moment.

Perhaps most elegant of all would be to make it so the game doesn’t automatically look at the beginning, but I’m not sure how to do that. Someone else probably knows, though.

Probably the easiest way to do it would be to physically move the player to a different room.

[code]Misery is a room. “You’re sitting at a desk with your head in your hands. Your heart is racing, and there is a faint scent of ozone in the air.”

Before doing something other than waiting or looking in Misery, try looking.

Instead of looking in Misery for the second time:
say “You lift your head from your hands with a sigh and examine your surroundings.”;
move the player to desk chair.

Laboratory is a room. “Papers and books are strewn all about you, along with various scientific instruments. There is a large machine in the corner.”

The desk chair is a supporter in Laboratory.[/code] That second line is optional, but makes behavior nicer; you can type “stand up” and it game will still remember that you wanted to do that first, after you take your head out of your hands to look.

(If you’re wondering, the first time you look in Misery is a look action automatically generated when play begins, otherwise the screen would be blank after the banner text.)

Ah, thank you both very much for the help. Already learned so much just from that alone, the system seems to make a bit more sense now.

Next steps are to anticipate a potential “stand up” command before a “look” command then rearrange the order of events to make it read more fluid, change “get off the desk chair” to “get up from desk chair”, and hide the desk chair from the room description. Think I should be able to figure all that out from the documentation. Exciting!

Thanks again!