"Instead of looking in" not working as expected.

This is probably a pretty newbish question, but I can’t figure out what I’m doing wrong.
I am simply trying to replace the default text for the “look in” command for a particular object. This is the line of code:

Instead of looking in the cooler when the cooler is open and there is something in the cooler, say “[if there is more than 1 caught fish in the cooler]Several fish spill[otherwise]A fish spills[end if] out of the container onto the ground.”.

Simple enough. Except when I run it and try looking in the cooler, I just get the default text listing what’s in the cooler. I searched the documentation but couldn’t figure out what I did wrong.

The action is named “searching”* so you need to say “Instead of searching the cooler…” In cases like this, where you’re not sure exactly what action your command is invoking, you can try typing “actions” in the command prompt of your game before you type “look in cooler”; that’ll tell you that the action it’s trying to perform is “searching the cooler.”

Inform will interpret “looking in the cooler” to mean performing the looking action when the player is in the cooler, which is not what you want.

*Technically if you ever need to refer to the action itself in code it’s “the searching action,” but you shouldn’t need to worry about that for awhile.

EDIT: Oh, and you probably want to have your “instead” statement move the fish from the cooler to the room you’re in; as it is, your command would tell the player that the fish have spilled out, but it won’t actually do anything to the fish.

Thanks! That was just what I needed. Everything works wonderfully now.

To clarify, it is my intent not to actually move the fish from the cooler, as the description of the room when the cooler is open includes a description of the fish spilling out of the cooler. The way I visualize it, the fish are kind of half in, half out of the cooler. I figured that as far as Inform is concerned, they can stay inside the cooler :slight_smile:

Ah! Might I suggest “poking”? “Spilling” really made me think that the fish were now on the floor.

Yeah, I guess I did specify “onto the ground,” so that’s fair. I picture a cooler on its side, with several fish still in the cooler but some of them entirely on the ground. Anyways, I’ll leave it up to the player’s imagination. It doesn’t affect gameplay, since the player gets the same description if she merely looks AT (or examines) the cooler when its open (and as I mentioned, it also gets included in the room description). Incidentally, the cooler is only ever open when its on its side. I won’t go into detail as to why that is, as that would reveal too much about my project :slight_smile: