Understanding 'Look In' as 'Look At'

Hi, it’s my first time on the forum, and I have been using Inform 7 for around two weeks.
My first project is in its final stages, but I am stuck. It is Japanese-mythology themed, for an English assignment.
At this point in the fiction, the player must look inside the sleeve of the kimono to receive the information he/she needs to win the game.

However, I cannot get my code to work.
“Look at sleeve” generates the correct reaction, however “Look in sleeve” is the logical thing for the player to type and I would really like for this to work properly.
Here is my code as it stands:

Instead of examining sleeve: If player has Tanka begin; Say "In the sleeve you spot the Tanka that Buta Shogun gave you on the night of the party. Maybe this has some significance. You should give it to Buta."; Otherwise; Say "There is nothing in the sleeve. It must have been your imagination. Buta turns to you. 'Please, will you marry me?' He asks, kneeling down. Slowly you feel your form shrinking, and you change back into a fox. Enraged and shocked, Buta Shogun strikes out against you in anger. You flee him, and hide in the forest, spending the rest of your life as a Kitsune. That is why Geisha, to this day, are forbidden from marrying."; End the game in death; End if.

Any suggestions you all have are greatly appreciated. I’m at my wit’s end!

Look in the Actions tab of the Index, or use the RULES testing command before you try ‘look in’. If I remember right, that’ll show you that >LOOK IN is a synonym for >SEARCH. So:

Instead of searching the sleeve: try examining the sleeve.

Or, if you want to make >LOOK IN a synonym for EXAMINE generally:

Understand the command "look in" as something new. Understand "look in [something]" as examining.

This won’t actually work – ‘Understand the command “blah” as something new’ only works on single words. In fact it’s a bug that the compiler accepts code with two words there (Understand the command “blah blah” as something new), since it ignores that code.

If you wanted to make “look in” always go to examining rather than searching, you’d have to use

Understand the command "look" as something new.

and then reimplement all the rest of the grammar for “look” (“look at,” etc.). This would be highly annoying! But if your game doesn’t ever use the searching action, you could just redirect all searching actions to examines, like this:

Instead of searching something: try examining the noun.

Hope this helps!

Thank you so much!! The code worked perfectly.

I used:
Instead of searching the sleeve: try examining the sleeve.

No more bugs! Thanks again. :slight_smile:

I’d probably suggest using a check rule rather than an instead rule (unsurprisingly! :stuck_out_tongue: ).

Check searching (this is the convert search to examine rule): try examining the noun instead.

It has the added advantage of being able to do these.

[code]Check searching (this is the convert search to examine rule): if (some condition), try examining the noun instead.

Check searching (this is the convert search to examine rule): unless (some condition), try examining the noun instead.[/code]

Here you can allow exceptions to pass through the rule and to have different search and examine results.

Hope this helps.

However, that has a disadvantage: Your check searching rule will be intercepted by the check searching rules previously defined in the Standard Rules. And these give the response “You find nothing of interest.” as soon as the player tries searching something that is not a container nor a supporter.

You could do the same kind of thing to the same result with instead rules. Just specify the conditions by a when clause inside the very rule preamble (this will also take care of most priority issues between your instead rules):

Instead of searching when <some condition>: try examining the noun.

Now I think about it, you’re right for simple situations where there are only a few rules. However, when things get complicated, having loads of instead rules can things tough to deal with.

Even in IF, situations stay simple more often than they get complicated. :slight_smile:

(Unless you’re writing an extension – then you have to start anticipating complicated games that it might be imported into.)

Putting conditions in the rule header has the added advantage that Inform will sort them for you.