problem with my IF... before entering in a door...

(Tubbadù) #1

Hi everyone! in my IF I wrote this:

the hole on the wall is a door. it is north of room1 and below room2.

before going north from room1:
	if the player is in room1:
		say "You enter in the hole on the wall. You walk in a narrow tunnel for a while, than you reach a wooden ladder. You start climbing it.".

before entering in the hole on the wall:
	if the player is in room1:
		say "You enter in the hole on the wall. You walk in a narrow tunnel for a while, than you reach a wooden ladder. You start climbing it.".

but if the player while he is in room1 writes nord it prints

and if he writes enter in hole on the wall it prints

??? what’s the problem???
It is important because if the player read “there is a hole on the northern wall”, he probably won’t write “nord”, but “enter in the hole”…

0 Likes

(matt w) #2

The action name for entering would be “entering the hole in the wall.” (The action name is “entering” followed by the noun.) When you type “Entering in the hole in the wall,” Inform basically understands that as “before (entering) (in the hole in the wall)”–which is to say “before entering [something, anything] [when the player is] in the hole in the wall”–which never happens, because the player can never actually be in the hole in the wall.

By the way you don’t need the if-clause in the first rule–since you have “from room1” in the room heading, you don’t need another check that the player is in room1.

0 Likes

(matt w) #3

In fact you can take care of both cases with one rule:

[code]the hole on the wall is a door. it is north of room1 and below room2.

before going from room1 through the hole on the wall:
say “You enter in the hole on the wall. You walk in a narrow tunnel for a while, than you reach a wooden ladder. You start climbing it.”.[/code]

0 Likes

(Tubbadù) #4

ahhh ok ok I understood, so it should be something like “entering through the hole in the wall”?

0 Likes

(Tubbadù) #5

Yess this is perfect!! thank you matt!

0 Likes

(matt w) #6

Just for posterity’s sake, since the other approach worked, you would write this:

before entering the hole on the wall: if the player is in room1: say "You enter in the hole on the wall. You walk in a narrow tunnel for a while, than you reach a wooden ladder. You start climbing it.".

just leaving out the word “in.”

0 Likes

(Tubbadù) #7

ahhhhhhh fantastic! thank you !

0 Likes