If current action condition generating compiler error

I’m trying to implement the full score scenario from the example “Bosch”. I have compiled and executed the example.

When I incorporate the same code from the example into my source, I get a compiler error on a line that compiles without error in a different context.

I’ve included the sample below for convenience. The compiler dies when dealing with this block of code with the error below:

[the say doesn't generate a compiler error, but the if current action does]
every turn:
	say "current action: [current action]."

After doing something:
	repeat through Table of Valuable Actions:
		if the current action is the relevant action entry and turn stamp entry is less than 0:
			now the turn stamp entry is the turn count;
			increase the score by the point value entry;
	continue the action.

Problem. In the sentence ‘if the current action is the relevant action entry and turn stamp entry is less than 0’ , I was expecting that ‘current action is the relevant action entry and turn stamp entry is less than 0’ would be a condition. It didn’t make sense as one long phrase, but because it was divided up by ‘and’/‘or’, I tried breaking it down into smaller conditions, but that didn’t work either. ‘current action is the relevant action entry’ did not make sense; ‘turn stamp entry is less than 0’ was okay; so I ran out of ideas.

I was trying to match this phrase:

if (current action is the relevant action entry and turn stamp entry is less than 0 - a condition):

But I didn’t recognise ‘current action is the relevant action entry and turn stamp entry is less than 0’.

Use scoring.

The Garden of Excess is a room. The gilded lily is an edible thing in the Garden of Excess.

The Pathway to Desire is west of the Garden of Excess. The emerald leaf is in the Pathway.

Table of Valuable Actions
relevant action	description	point value	turn stamp
taking the emerald leaf	"Emerald Leaf"	15	-1
eating the gilded lily	"Gilded Lily"	5	-1

The maximum score is 25.

After doing something:
	repeat through Table of Valuable Actions:
		if the current action is the relevant action entry and turn stamp entry is less than 0:
			now the turn stamp entry is the turn count;
			increase the score by the point value entry;
	continue the action.

Understand "full score" or "full" as requesting the complete score. Requesting the complete score is an action out of world.

Check requesting the complete score:
	if the score is 0, say "You have not yet achieved anything of note." instead.

Carry out requesting the complete score:
	say "So far you have received points for the following: [line break]";
	sort the Table of Valuable Actions in turn stamp order;
	repeat through the Table of Valuable Actions:
		if the turn stamp entry is greater than 0:
			say "[line break] [description entry]: [point value entry] points";
	say line break.

Test me with "eat lily / w / full score / get leaf / full".

I dropped your second block of code into a blank document and it compiled and ran fine. I also fleshed out my own version of your first code block, and that compiled fine, too:

Summary
Lab is a room.

an apple is in lab.

Table of Valuable Actions
relevant action	description	point value	turn stamp
taking the apple	"Emerald Leaf"	15	-1
eating the apple	"Gilded Lily"	5	-1

every turn:
	say "current action: [current action]."

After doing something:
	repeat through Table of Valuable Actions:
		if the current action is the relevant action entry and turn stamp entry is less than 0:
			say "YES.";

Are you able to compile the second block on its own in a blank document?

-Wade

The second block is the Bosch example from the Inform 7 docs. In a blank document it compiles and executes as expected.

The first block was the EXACT same snippet as in the Bosch example. When it failed to compile, I added the 'say “[current action]” line expecting it to fail the compilation as well. But that line compiled fine.

So, I tried moving the code around the source file thinking it may change the compilation profile but no dice.

So the problem is the same code in two projects; one compiles, the other doesn’t.

I’m at a loss.

Never mind. It was a typo: relevant v. relevent

My first guess would be to double check your Table of Valuable Actions and confirm that it’s formatted properly and that the headings don’t have typos. Beyond that I’m not sure.

Edit: jinx

1 Like

Ha, I was watching for that when I was scanning the code. But I guess it was somewhere else in your code?

-Wade

1 Like