Help with a new action "fixing"

HI again everyone.

I’ve added a few things to a game I’m working on and I’ve come so so close to doing the whole thing alone. I can “fix” something but I’m having trouble excluding all other things.

fixing it with is an action applying to one visible thing and one carried thing.  Understand "fix [something] with [something]" or "mend [something] with [something]" or "repair [something] with [something]" or "seal [something] with [something]" as fixing it with.

instead of fixing the shell with the sticker:
	say "Taking the sticker out of your pocket you carefully unfold it and apply it to the damaged shell. Success! The banana sticker holds fast.[paragraph break]You're not sure what a happy hermit crab looks like but you're pretty sure this little guy is happy now as they scuttle away into the seaweed.";
	now the sticker is nowhere;
	now the hermit crab is nowhere;
	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]."
	

instead of fixing when [the noun] is not the shell:
	say "You've always adhered to the maxim [']If it ain't broken, don't fix it!['] and this ain't broke.".

The last line doesn’t work, that’s just the last try I made before throwing myself on the mercy of the experts.

instead of fixing when [the noun] is not the shell:
	say "You've always adhered to the maxim [']If it ain't broken, don't fix it!['] and this ain't broke.".

You’ve got backwards when you want brackets around the apostrophe: unbracketed apostrophes in texts end up being double-quotes. ['] is for when you really want an apostrophe.

I’d also suggest using Check rules for qualifying whether the action can occur, e.g.,

check fixing it with when the noun is not the shell:
instead say "You've always adhered to the maxim 'If it ain[']t broken, don't fix it!' and this ain[']t broke.".

check fixing it with when the second noun is not the sticker: instead say "[We] [can't] fix [the noun] with [regarding the second noun][those].".

and then…

carry out fixing it with when the noun is the shell and the second noun is the sticker:

If you use Instead everywhere it’s easy to get into trouble if they get processed in the wrong order. It ends up making things more complicated and thus more fragile and harder to modify. But you know that Check rules will always come before the Carry out rules.

5 Likes

I was close. So I’ll take heart that I’m improving.

Thank you.

1 Like

That works perfectly @Zed.

But… it looks like I may have wanted something different. What if I wanted to stop fixing when they say fix ‘not the sticker’ instead of prompting them to specifiy what they want to fix it with and then telling them they couldn’t fix it?

1 Like

Good thinking – always nice to head off player annoyance. I think the easiest thing is probably to define another single-noun action:

Fixing is an action applying to one thing.
Understand "fix [something]" as fixing.
Instead of fixing when the noun is the shell, say "You'll have to fix the shell WITH something.".
Instead of fixing, say "ain[']t broke, don[']t fix.".

And then to automatically get all of the synonyms to work with both, instead of:

Understand "fix [something] with [something]" or "mend [something] with [something]" or "repair [something] with [something]" or "seal [something] with [something]" as fixing it with.

you can use:

Understand "fix [something]" as fixing.
Understand "fix [something] with [something]" as fixing it with.
Understand the commands "mend", "repair", and "seal" as "fix".

Thank you again.

Maybe I’ve not cleaned up somewhere else but it’s throwing this error now:

Problem. You wrote ‘Understand “fix [something]” as fixing’ : but ‘understand … as …’ should be followed by a meaning, which might be an action (e.g., ‘understand “take [something]” as taking’), a thing (‘understand “stove” as the oven’) or more generally a value (‘understand “huitante” as 80’), or a named token for use in further grammar (‘understand “near [something]” as “[location phrase]”’). Also, the meaning needs to be precise, so ‘understand “x” as a number’ is not allowed - it does not say which number.

Do you have the stuff from the first code block above in there, too? Specifically:

I appreciate you noodling this for me.

The entire block I have is:

Fixing is an action applying to one thing.
Understand "fix [something]" as fixing.
Instead of fixing when the noun is the shell, say "You'll have to fix the shell WITH something.".
Instead of fixing, say "ain[']t broke, don[']t fix.".

Understand "fix [something] with [something]" or "mend [something] with [something]" or "repair [something] with [something]" or "seal [something] with [something]" as fixing it with.

check fixing it with when [the noun] is not the shell:
	say "You've always adhered to the maxim [']If it ain't broken, don't fix it!['] and this ain't broke.".

check fixing it with when the second noun is not the sticker: instead say "[We] [can't] fix [the noun] with [regarding the second noun][those].".

I think you removed your “fixing it with” definition. You still need that; it’s a different action. (That was a particularly confusing error message…)

1 Like

I think I’ve swum out of my depth. So, if you’ve had enough I understand.

In any case, the error it is throwing now is-

Problem. You wrote 'check fixing it with when is not the shell'  : but I don't understand the 'when/while' clause, which should name activities or conditions.

Which centres on the command:

check fixing it with when [the noun] is not the shell:
	say "You've always adhered to the maxim [']If it ain't broken, don't fix it!['] and this ain't broke.".

For clarity, the entire code relating to fixing is as follows:

fixing it with is an action applying to one visible thing and one carried thing.  Understand "fix [something] with [something]" or "mend [something] with [something]" or "repair [something] with [something]" or "seal [something] with [something]" as fixing it with.

check fixing the shell with the sticker:
	say "Taking the sticker out of your pocket you carefully unfold it and apply it to the damaged shell. Success! The banana sticker holds fast.[paragraph break]You're not sure what a happy hermit crab looks like but you're pretty sure this little guy is happy now as they scuttle away into the seaweed.";
	now the sticker is nowhere;
	now the hermit crab is nowhere;
	now the hermit crab is unbroken;
	say "[line break]Your score is [score] out of 10.[paragraph break]You are carrying [the list of things enclosed by the player].";
	increase the score by 1;
	stop the action.

Fixing is an action applying to one thing.
Understand "fix [something]" as fixing.
Instead of fixing when the noun is the shell, say "You'll have to fix the shell WITH something.".
Instead of fixing, say "ain[']t broke, don[']t fix.".

Understand "fix [something] with [something]" or "mend [something] with [something]" or "repair [something] with [something]" or "seal [something] with [something]" as fixing it with.

check fixing it with when [the noun] is not the shell:
	say "You've always adhered to the maxim [']If it ain't broken, don't fix it!['] and this ain't broke.".

check fixing it with when the second noun is not the sticker: instead say "[We] [can't] fix [the noun] with [regarding the second noun][those].".

At the risk of confusing things, an alternate approach that doesn’t involve creating a new single-noun action is to create a new Understand command that just has one noun, and then write a rule for supplying the second noun:

An object can be broken or unbroken.  An object is usually unbroken.

Use scoring.

Test chamber is a room.    the shell is in the test chamber.  The sticker is in the test chamber.  The paste is in the test chamber.  The vase is in the test chamber.  The hermit crab is in the test chamber. The hermit crab is broken.  

Fixing it with is an action applying to one visible thing and one carried thing.  

Understand "fix [something]" as fixing it with.
Understand "fix [something] with [something]" as fixing it with.
Understand the commands "mend", "repair", and "seal" as "fix".

check fixing it with when the noun is not the shell:
instead say "You've always adhered to the maxim 'If it ain[']t broken, don't fix it!' and this ain[']t broke.".

check fixing it with when the second noun is not the sticker: instead say "[We] [can't] fix [the noun] with [regarding the second noun][those].".

carry out fixing it with when the noun is the shell and the second noun is the sticker:
	say "Taking the sticker out of your pocket you carefully unfold it and apply it to the damaged shell. Success! The banana sticker holds fast.[paragraph break]You're not sure what a happy hermit crab looks like but you're pretty sure this little guy is happy now as they scuttle away into the seaweed.";
	now the sticker is nowhere;
	now the hermit crab is nowhere;
	now the hermit crab is unbroken;
	say "[line break]Your score is [score] out of 10.[paragraph break]You are carrying [the list of things enclosed by the player].";
	increase the score by 1.
	
Rule for supplying a missing second noun while fixing:
	If the noun is not the shell, say "You've always adhered to the maxim 'If it ain[']t broken, don't fix it!' and this ain[']t broke." instead;
	Say "You'll have to fix the shell WITH something."

I’ve pasted in your full logic to make it easier to see how it all works, but the relevant pieces are here:

Understand "fix [something]" as fixing it with.

...

Rule for supplying a missing second noun while fixing:
	If the noun is not the shell, say "You've always adhered to the maxim 'If it ain[']t broken, don't fix it!' and this ain[']t broke." instead;
	Say "You'll have to fix the shell WITH something."

The relevant bit of the docs on how supplying a missing noun/second noun works is here, but hopefully it makes sense – this is an activity that fires when the player omits a noun.

NB that you could modify this rule so that it automatically selects the sticker, if it’s carried or nearby, which might make things easier on the player. I’m also not sure how the crab relates to the shell, but it sounds like fixing the crab should work the same way as fixing the shell? if so you might want to catch that. If you make those changes, the relevant bits should look like this:

Rule for supplying a missing second noun while fixing:
	If the noun is not the shell and the noun is not the hermit crab, say "You've always adhered to the maxim 'If it ain[']t broken, don't fix it!' and this ain[']t broke." instead;
	if the sticker is carried by the player or the sticker is in the location, now the second noun is the sticker;
	otherwise:
		say "You'll have the fix the shell WITH something."
		
Instead of fixing the hermit crab with something, try fixing the shell with the second noun.

Again, apologies if this is confusing things! I just find it’s easier for me to have fewer actions to worry about so this way seems simpler to me, though Zed’s way will of course work well too!

3 Likes

It was implicit in the other answers, but just a quick note to emphasize that you shouldn’t put “[the noun]” in brackets like that in the rule preamble. Outside of text in quotation marks, anything in brackets is treated as a comment and ignored by the compiler.

So, it should be: check fixing it with when the noun is not the shell: ....

(Which also explains why the error message is saying:
Problem. You wrote 'check fixing it with when is not the shell'” – “the noun” is missing between “when” and “is”, the compiler didn’t even see it.)

3 Likes

I value yours, and everyone’s time, and that you chose to use it to answer my question so thoroughly is humbling.

I’ll have to digest that for a bit, but at a cursory glance, I think I follow what you’ve done.

1 Like

Yeah, Mike’s supplying a second noun approach is better.

2 Likes