Understands and actions bedeviling me

As I do each year I’m making a short int-fiction as a greetings card but, as you’d expect, skills deteriorate without practice so I’m throwing myself on your mercy.

I’m reusing a command from last year and it looks like I’ve made the correct substitutions but I must not have and I can’t see the issue.

The error is-
Problem. You wrote 'Check covering when the player encloses the poster and the player encloses the stickytack' : but I don't understand the 'when/while' clause, which should name activities or conditions.

Can you help?

[##### UNDERSTANDS #####]

Understand the command "cover" as something new.
Understand "cover [something]" as covering.

covering is an action applying to one visible thing.

an object can be covered or uncovered.

an object is usually uncovered.

Check covering when the player encloses the poster and the player encloses the stickytack:
	if the noun is not the hole, say "That's not a good idea." instead.

Check covering when the player encloses the poster and the player does not enclose the stickytack:
	say "You know gravity's a thng right. What are you attaching it with?";
	stop the action.

check covering when the the noun is not the hole:
	say "This appears to be here to stay!";
	stop the action.

before covering when the player does not enclose the poster and the noun is the hole:
	say "What you really need is something large and papery to get this job done.";
	stop the action.
	
after covering the hole when the hole is uncovered:
	say "What hole. I don't asee a hole";
	now the hole is covered;
	move the hole to the player;
	increase the score by 1;
	say "[line break]Your score is [score] out of 10.[paragraph break]You are carrying [the list of things enclosed by the player]."

What’s the exact behavior you’re getting that you don’t want (or aren’t getting but do want)? It’s a little hard to figure that out from just looking at the code.

Sorry @Mike Russo I’ve included the error message.

Have you defined the poster and the stickytack? If not, or if there’s a spelling error in one of them, for instance, you’ll get this unhelpful error.

Does the code work if you remove one half of the ‘and’ clause?

3 Likes

Yeah, I just pasted this into Inform, created the three mentioned objects (poster, hole, and stickytack) and it compiled fine, so I’m guessing those haven’t been created properly (Victor’s typo theory seems like a contender to me).

1 Like

OMG! I made a rule correctly first time!!!

Thanks, I did have a spelling mistake (included a hyphen in the sticky-tack) elsewhere!

Other than that is it well-formed?

1 Like

It feels a little sprawling to me – following the different conditions makes it hard to read, and the interaction between all the different rules isn’t easy to parse. I tend to like to condense my rules since that makes it simpler to work with them – I might refactor to something like this:

Check covering:
	If the noun is covered, say "That's already covered up!" instead;
	If the noun is not the hole, say "This appears to be here to stay." instead; [this case and the "that's not a good idea" rule appear to largely overlap, so I'd just go with one to avoid unintuitive redundancy]
	If the player does not enclose the poster, say "What you really need is something large and papery to get this job done." instead;
	If the player does not enclose the stickytack, say "You know gravity's a thing, right?  What are you attaching it with?" instead.
		
Carry out covering when the hole is uncovered:
	say "What hole. I don't see a hole";
	now the hole is covered;
	move the hole to the player;
	increase the score by 1;
	say "[line break]Your score is [score] out of 10.[paragraph break]You are carrying [the list of things enclosed by the player]."

Of course code style is really personal, so this might not work for you – just figured I’d share it in case it seems useful!

I will look that over.

Thank you for taking the time to lay it all out.