How do I spray saltwater on toads and spray toads with saltwater?

Hi again. With one thing and another I’ve left my run at my annual intfiction Christmas Card too late.

I’ve kept things as simple as I can but I’ve run into a complex (for me) issue I can’t conquer. I could use a few specific command recognitions but first I wanted to give this an honest try.

There are some toads stopping the player getting some flowers. The player collects a spray bottle and then fills it with saltwater squirts it on the toads and they vacate the area so the player can get the flowers.

As the card goes to non-intfictioners I want to make things as intuitive as possible to reduce frustrations. As a result I want them to be able to:

  • enter spray toads (I’ll check them having the saltwater in a spraybottle in their inventory)
  • enter spray salt water (I’ll check this against the location of the toads)
  • enter spray salt water on toads
  • enter spray toads with salt water

I’ve done something like this before but, at the time, didn’t have a great grip on it. I’ve tried to cannibalize previous code (which I understand is what good coders do) but I’ve come up short in oh so many ways. For example even in the first line would it be easier to make the toad an object (it doesn’t need to be an animal) because the toad gets sprayed (on) but the saltwater get spray (out)? This in turn creates problems for my check statements.

It’s a horror show.

Maybe I’m making this too difficult in some way.

Thank you in advance.

a thing can be sprayed.
a thing is not usually sprayed.

Understand the command "spray" as something new.  

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


Understand "spray [something] on/with [something]" as spraying it with (with nouns reversed)


Check spraying it with:
	If the noun is sprayed, say "You've sprayed that already." instead;
	If the noun is Mrs whip, say "On the list of your poor choices this one would probably go stright to the top." instead;
	If the noun is not the saltwater, say "You can't spray that." instead;
	If the second noun is not the toads, say "Don't spray those." instead;
	If the player does not enclose the spraybottlefull, say "You need the right toolls for this job." instead.
		
Carry out spraying it with:
	say "Squit squit. You spray the toads.";
	now the toads are nowhere;
	increase the score by 1;
	say "[line break]Your score is [score] out of 10."
1 Like
Spraying it on is an action applying to two things.
Understand "spray [something preferably held] on [something]" as spraying it on.
Understand "spray [something] with [something preferably held]" as spraying it on (with nouns reversed).

Spraying is an action applying to one thing.
Understand "spray [something]" as spraying.

Before spraying the spray bottle:
    if the toads are visible:
        say "(on the toads)[command clarification break]";
        try spraying the spray bottle on the toads instead;
    otherwise:
        say "You'll need to be more specific." instead.

Before spraying something:
    if the spray bottle is held:
        say "(with the spray bottle)[command clarification break]";
        try spraying the spray bottle on the toads instead;
    otherwise:
        say "You have nothing to spray with." instead.

Check spraying something on:
    if the noun is not the spray bottle, say "[The noun] [are] not very good for spraying." instead.

Check spraying the spray bottle on something:
    if the second noun is not the toads, say "[The second noun] [don't] really need a dose of salt water right now." instead.
5 Likes

@Draconis got there first with a more polished solution than the one I had written up but I think it’s worth highlighting this:

Understand "spray [something] on/with [something]" as spraying it with (with nouns reversed)

There’s no point giving every grammar line for a command the annotation (with nouns reversed). Rather, that’s there to cover the situation where you have two phrasings, and the order of the noun and the second noun are switched between the two. So notice that in the example from @Draconis only one of the two grammar lines has reversed nouns:

2 Likes

Thank you everyone.

I’ve created a sandbox for this as incorporating it directly got me a very exciting Error 11! I’ll figure that out afterwards. I’ve narrowed it down to something unrelated.

Anyway here’s what I have which is @Draconis work with some details added to make it playable. Unfortunately it is causing the compiler to ask for more specificity than I can provide. It must be a problem with my items at the bottom somehow.

Spraying it on is an action applying to two things.
Understand "spray [something preferably held] on [something]" as spraying it on.
Understand "spray [something] with [something preferably held]" as spraying it on (with nouns reversed).

Spraying is an action applying to one thing.
Understand "spray [something]" as spraying.

Before spraying the spraybottle:
	if the toads are visible:
		say "(on the toads)[command clarification break]";
		try spraying the spraybottle on the toads instead;
	otherwise:
		say "You'll need to be more specific." instead.

Before spraying something:
	if the spraybottle is held:
		say "(with the spraybottle)[command clarification break]";
		try spraying the spraybottle on the toads instead;
	otherwise:
		say "You have nothing to spray with." instead.

Check spraying something on:
	if the noun is not the spraybottle, say "[The noun] [are] not very good for spraying." instead.

Check spraying the spraybottle on something:
	if the second noun is not the toads, say "[The second noun] [don't] really need a dose of salt water right now." instead.
		
the glade is a room.

the toads are an animal in the glade.

the spraybottle is a container.

the spraybottle is in the glade.

the printed name of the spraybottle is "spray bottle".

the saltwater is an object in the glade.

check inserting the saltwater into the spraybottle:
	say "successfully armed".

Specifically:

Problem. You wrote 'try spraying the spraybottle on the toads'  , but 'spraying the spraybottle on the toads' is too vague to describe a specific action.
 It has to be an exact instruction about what is being done, and to what.

What version of Inform are you using? I just pasted your sample code into Borogove (which uses 10.1.2), and it compiled correctly:

version 1.68.1

Changing the name of the action (in code) from “spraying it on” to “spraying it onto” fixes it for me. (You can still understand “spray [something] on [something]” as spraying it onto, so it doesn’t affect what the player needs to type.)

I think the problem is that “spraying the spraybottle on the toads” can be understood as saying you want to do the single-noun kind of spraying with the spraybottle as the direct object, and Inform thinks you’re trying to disambiguate which spraybottle by telling it to use one which is currently on top of the toads.

2 Likes

FYI: That’s not the Inform version, that’s the version of the IDE (which is what you see when you click on “About Inform” in the menu). The version of Inform you’re using is shown in the banner when you hit “Play” to compile and run your game. It will look something like this: (I’ve bolded the Inform version)

The Lab
An Interactive Fiction by Michael Tarbert
Release 1 / Serial number 241215 / Inform 7 v10.1.2 / D

1 Like

Inform 7 build 6M62 (I6/v6.34 lib 6/12N) SD

1 Like

@jwalrus Thank you, you’re the business!

I made it this but I’m just parroting you so I somehow did it wrong as it did not fix things.

EDIT. I missed one! It works. Testing now.

Spraying it onto is an action applying to two things.

Understand "spray [something preferably held] on [something]" as spraying it onto.
Understand "spray [something] with [something preferably held]" as spraying it onto (with nouns reversed).

Spraying is an action applying to one thing.
Understand "spray [something]" as spraying.

Before spraying the spraybottle:
	if the toads are visible:
		say "(on the toads)[command clarification break]";
		try spraying the spraybottle onto the toads instead;
	otherwise:
		say "You'll need to be more specific." instead.

Before spraying something:
	if the spraybottle is held:
		say "(with the spraybottle)[command clarification break]";
		try spraying the spraybottle on the toads instead;
	otherwise:
		say "You have nothing to spray with." instead.

Check spraying something onto:
	if the noun is not the spraybottle, say "[The noun] [are] not very good for spraying." instead.

Check spraying the spraybottle onto something:
	if the second noun is not the toads, say "[The second noun] [don't] really need a dose of salt water right now." instead.

2 Likes

Good catch! I missed that!

It’s only ambiguous because there’s the separate “spraying” action, which means “spraying [the box on the table]” is a valid interpretation. “Onto” is never ambiguous, so that’s the better option.

3 Likes

You guys are the best.

Such a great community focused on support not one-upping.

1 Like

Another one of those gems that when overheard in casual conversation would make eyebrows wrinkle in confusion.

2 Likes