Overenthusiastic rule?

Hello, I am Random and I’m a beginner Inform 7 user. I’m making a little basic adventure game. I have lots of experience with other languages like Java and Python, but for some reason I find myself struggling to master the basic syntax of Inform. One piece of code in particular that I am stuck on is this:

I’m sure you can guess what the Forest Maze is. It’s not actually a maze, just a room with this little rule applied to it so that until the player creates landmarks for himself(I have that action coded and it works perfectly), he will just be lost in the area. landmarkyes is a variable that is set to change to 1 as soon as the player creates landmarks, and I have confirmed that piece of code to be functioning properly.

However, despite every other rule working in this instance, whenever I have this rule or minor variants of it (like using “every turn” instead of “before”) in the source text, it always applies regardless of both conditions. So instead of that statement only appearing whenever you try to go anywhere in the Forest Maze, whenever you try to go anywhere in any room that statement will appear, and it is regardless of whether you have created landmarks or not. I must be missing something big, but I can’t tell.

I would appreciate any help you can give me.

This should work, unless perhaps you have messed up the indentation? (The tabs got lost when you pasted into the forum, so I can’t tell.)

This simplified example works:

The Forest Maze is a room.

The Kitchen is west of the Forest Maze.

The landmarkyes is a number that varies.

Before going direction:
	if the player is in the Forest Maze:
		if landmarkyes is 0:
			say "You seem to be walking in circles regardless of which way you go.";

I’ll note that you’ll get a better result if you add “stop the action” after the say phrase (at the same level), so that the default “You can’t go that way” is blocked.

Wow, it works perfectly! I’m still trying to figure out where I went wrong. I guess I did have the indentations messed up somehow. Thank you for the help!

There’s actually one more problem that I’m having, and it is that I created a door that is supposed to be hacked down with a machete (literally called the thin branches). I have the door clearly mentioned in the description of the room, so I don’t need the door to be listed every turn, but when I try using:

It compiles fine, but it still lists the thin branches (and as “You see a many branches here”, which is even worse). Why is that?

It would be better to just call them scenery.

Oh man I’m such a moron… Thanks for the help!

It’s not like that “some reason” is something unheard of. I7 is a peculiar language both in syntax and paradigm, and it takes some getting used to. But it’s really cool too, so hang in there! And do ask when you get stuck, this is a really helpful crowd.

Inform 7 is easy to pick up but difficult to master. Its learning curve is very shallow but also very long…

I’ve been looking through the documentation, but I haven’t been able to find a way to make it so a container can only hold one kind of thing. I’ve tried coding a rudimentary and very inelegant rule for it that applies to just one container, but I’m struggling with how to word it.

For reference, here’s what I’ve got written, but clearly the second line is the problem because I don’t know how to tell it to refer to the same thing mentioned in the first line:

Is there an easy shorthand for referring to specific terms in previous lines of a block?

This is how I made a holster for my revolver (in my IF’s, not real life) and have the holster only be able to contain the revolver:

instead of inserting something into the holster: if the noun is the revolver: continue the action; otherwise: say "Only the revolver fits in the holster."; stop the action.

Is this sort of what you are talking about? Does that help?

There are a couple.

Instead of inserting a thing (called T) into a canteen:

Or, the object of the current action is always “the noun”. (And “the second noun” for inserting.) That’s where MTW’s suggestion comes from.

Or, condensing further:

Instead of inserting something into a canteen when the noun is not a tome:

(This lets you cut out the “otherwise stop the action” case, because you’re limiting the rule to a single case.)

That solved the issue! And I learned a few new things about syntax! Thanks for the help!