Getting a property of an adjacent room

I have given rooms the property of being either wet or dry, successfully (I think). However, I want to be able to determine whether the room to the west of the player’s location is wet (I am currently using it to determine what rooms are stormy, and the storm is moving westward). So far, I have this:

[code]A room is either wet or dry. A room is usually dry.

Every turn when player is in the Plains, the Gorge, or the Upper Plains:
If turn count = 2
begin;
change Grass WNW to wet;
change Grass WW to wet;
change Grass WSW to wet;
change North Gorge WW to wet;
change North Gorge W to wet;
change South Gorge WW to wet;
change South Gorge W to wet;
end if;
If turn count = 3
begin;
change Grass NW to wet;
change Grass W to wet;
change Grass SW to wet;
change North Gorge C to wet;
change North Gorge EC to wet;
change South Gorge C to wet;
change South Gorge EC to wet;
end if;
If turn count = 4
begin;
change Grass N to wet;
change Grass C to wet;
change Grass S to wet;
change North Grass W to wet;
change North Grass NW to wet;
change North Grass N to wet;
change North Gorge Fork to wet;
change North Gorge SE to wet;
change North Gorge Drain to wet;
change Northern Gorge S to wet;
change South Gorge NE to wet;
end if;
If turn count = 5
begin;
change Grass NE to wet;
change Grass EC to wet;
change Grass SE to wet;
change North Grass E to wet;
change Northern Gorge C to wet;
change Northern Gorge N to wet;
change Grass E to wet;
end if;
If turn count = 6
begin;
change Grass WNW to dry;
change Grass WW to dry;
change Grass WSW to dry;
change Grass NW to dry;
change Grass W to dry;
change Grass SW to dry;
change Grass N to dry;
change Grass C to dry;
change Grass S to dry;
change Grass NE to dry;
change Grass EC to dry;
change Grass SE to dry;
change Grass E to dry;
change North Grass E to dry;
change North Grass W to dry;
change North Grass NW to dry;
change North Grass N to dry;
end if;
If player is in the Plains
begin;
If location is wet
begin;
if a random chance of 3 in 5 succeeds
begin;
say “The storm is right above you, soaking your clothes. Lightning strikes the ground near you, making you jump.”;
otherwise;
end the game saying “You have been struck by lightning.”;
end if;
otherwise if the room west of the location is wet, say “The storm is getting closer; you can see the rain falling just to the west.”;
end if;
end if;[/code] The plains, gorge, and upper plains are all regions. I am getting a few error messages with this. The first one,

(also with turn count equaling 3, 4, 5, and 6) I assume is saying that I have the wrong format for these conditions, ant that I could figure out the right one relatively quickly. The other,

is a bit trickier. This is my first time using Inform, and I am still learning the language. If anyone could help me solve these problems, I would greatly appreciate it.

There is no equals sign in Inform. What you have to say is, “if the turn count is 2”.

I think that means you’re trying to mix inline if-then format with block (begin/end if) if-then format. Inform has trouble with that. Try:

If player is in the Plains begin; If location is wet begin; if a random chance of 3 in 5 succeeds begin; say "The storm is right above you, soaking your clothes. Lightning strikes the ground near you, making you jump."; otherwise; end the game saying "You have been struck by lightning."; end if; otherwise; if the room west of the location is wet begin; say "The storm is getting closer; you can see the rain falling just to the west."; end if; end if; end if;

Thanks! That solves almost everything. I think that I originally did have ifs instead of =, but I think that I changed them when I saw one of the error messages. :unamused: Anyway, those work now, and I am only getting an error for one part of the code:

Again, any help is appreciated!

That’s a tricky one, but I finally figured it out. You need to say, “if the room west from the location is wet begin”.

Thanks! Is there any way to modify that code to check if the player is entering a wet room in the gorge from the plains? I know that the code given in the second example in Emily Short’s Basic Screen Effects extension can check to see what directions lead to a room, but I don’t know how to check to see if the room in the direction the player is going is wet or not. To give an example:

(most of the rooms in the area that I am working on are called “Plains” as well).

Also, I added another condition, making the player drown when he is in a room in the gorge that becomes wet, but this is giving me a few errors.

If the player is in the Gorge begin; say "You hear a rushing sound behind you, and turn to find a flood rushing towords you." end the game saying "You have drowned." end if;

I’d like help with this, but I have to go and will probably not be able to check any responses until this evening or tomorow.

The going action has a variable called “the room gone to”. If “Gorge” is a region, you can say:

Instead of going to the Gorge when the room gone to is wet, say "whatever".

You forgot to put semicolons at the ends of the lines.

slaps head Well, that is one of the things I have trouble remembering to do. Thanks for pointing it out.

Gorge is a region, but when I tried to use it in my code I got:

Thanks for all the help!

Ah, sorry, it seems Inform wants to see an object name there, not a description. Try this:

Instead of going to a wet room that is in the Gorge: say "whatever."

It works! :smiley: Thanks! That should be all I need for this part of the game, but I’ll ask (most likely in a different thread) if I run into any more problems.