Indentation Headaches? Back to the Shop...

Alright, I don’t know if this is an indentation issue or if I’m just nesting conditionals incorrectly. Here’s what I’ve got:

"Indendation" by I4L

SomeNumber is a number variable.

Instead of examining anything:
	Say "You have more important things on your mind! [run paragraph on]"

The Shop is a room. "Various and sundry items are scattered about. You are currently strapped to a conveyor that pulls your head closer and closer to a deadly table saw."

The Front Yard is a room. "It doesn't matter what this looks like, as you'll never live to see it." The Front Yard is north of the Shop.

TableSaw is a device in the Shop. The printed name is "Table Saw". Understand "saw" as TableSaw. TableSaw is switched on. The TableSaw is undescribed.

The conveyor is in the Shop. Understand "belt" as conveyor. The conveyor is undescribed.

SomeScene is a scene. SomeScene begins when play begins. SomeScene ends when SomeNumber is 20.

When SomeScene begins:
	Every turn when TableSaw is switched on:
		Increase SomeNumber by 1;
		say "You are pulled a little closer to the saw!";
		say SomeNumber;
		If SomeNumber is 10:
			say "Unfortunately Supes was having a kryptonian bowel movement and Spidey was picking up his tights from the dry cleaners. On the positive side, the blinding and searing pain in your skull is mercifully short-lived, as the blade of the saw divides you evenly in twain to the shoulders.[paragraph break]This all started with that damn screw...";
			End the game.

This particular incarnation produces the following foolishness:

Points of interest:

  • “The first phrase gone awry…” is 100% not true, because there are no errors if I remove everything after “Say SomeNumber;”
  • I’ve tried all manner of indentation and get varied error messages depending on how deeply (or not) things are indented.

The question, then… Golly gee, is this truly an indentation problem or just sloppy writing? Or both?

I’ve looked through the manual (just for you, matt w) and I’ve searched the first half dozen or so pages of the forum. (Indendation is common term.) But the indentation looks right to me.

[I know, I probably should have removed a lot of the “fluff” in the sample.]

Is the problem that you have both “When SomeScene begins:” and “Every turn when TableSaw is switched on:”? (I don’t have time to test, nor am I an Inform Master, but that looks fishy to me.)

That apparently would be the problem. I’m hoping that this is only because it’s a “when play begins” scene, as I can foresee wanting to use turn checking during scenes at some point.

(Also just saying “End the game” is not for cool kids.)

Maybe “Every turn during SomeScene” is the phrase you’re looking for?

Well, in the actual project, I don’t want that counter running every turn, only when a specific thing is happening. I’m obviously mishandling the scene functionality somehow.

You can add that to the rule preamble as well:

Every turn when TableSaw is switched on during SomeScene:

So the moral of the story, basically, is that this had absolutely nothing to do with indentation…

Right. I think this is what happens.

Inform reads the original code as

[code]When SomeScene begins: do nothing.

Every turn when TableSaw is switched on:
	Increase SomeNumber by 1;
	[etc.][/code]

In a technical sense there is an indentation issue here, since the line “Increase SomeNumber by 1;” is two tabs indented (whereas, of course, it should be only one tab indented).
When you delete or comment out the closing lines (from “If SomeNumber is 10;” on), that particular issue disappears, because the rule is then formally no longer written with colon-and-indentation syntax. This is because the phrases that remain could all be written on the same line and would still compile fine:

Every turn when TableSaw is switched on: Increase SomeNumber by 1; say "You are pulled a little closer to the saw!"; say SomeNumber.

This is probably connected to this bug that (seemingly) allows nesting rule definitions. The compiler isn’t prepared to find such situation so it behaves erratically.

But yes, the main problem was that you were trying to create a rule mid-game, which is not possible.

No, the problem is that I7 makes learning so freakin’ difficult, as you’ve discovered. It sounds like you have a solution to this particular problem, but I hope you’ve steeled yourself for the long haul. There will be many, many more problems of similar asininity. Trash like that is why I gave up on I7.

Haha. Well, I refuse to let it beat me! I think I’ve overcome the major obstacles that I need to at this point. Not looking forward to dialog, but I’ll hopefully be able to save that for the end.

Actually, I consider this particular situation to be 100% a problem of documentation. After getting the hang of the rule paradigm, I really love it, but there’s just not enough explanation of it in the manual.

I think it was Poster who said in another thread that the documentation was written more like a novel. As I was reading said documentation last night, there was a sentence along the lines of “So far our interactions with the player have been nothing but ripostes.”

Made me think of that thread. Gave me a little chuckle. I don’t think I’ve ever seen the word “ripostes” used in a technical manual before.