Oh, look!

… or don’t.

I’m having trouble getting the look command to work.

Here’s the code I wrote:

Instead of looking: say “[if player is on top of Desk and stepladder is on top of Desk]You and the ladder are on top of the desk.”

And the parser just seems to ignore it.

How come, I wanna know, and what can I do to get the parser to cooperate? (I know something about the parser’s sister, but I don’t believe in blackmail.)

Do you need the “top”? Maybe it thinks “top of desk” is an object.

That doesn’t appear to be the problem, but thanks.

Not sure what you mean by “the parser just seems to ignore it.” Your instead rule will always intercept the action of looking. If the conditions are not met (if the player or the stepladder is not on the desk) there will be no output at all from the look action. If this is not the desired result of the action (and it’s hard to see why it would be), you need to put the if-clause outside of the quote. Something like this:

Instead of looking: if the player carries the banana: say "Blind as a banana."; otherwise: continue the action.

I did that. It still refuses to respond to the word “look.” Is “look” not a word Inform 7 understands?

If the parser doesn’t understand the word ‘look’, the game should respond, “That’s not a verb I recognize.” Is that what’s happening? Or are you getting a blank line of output followed by a new input cursor?

In either case, something else in your code (or possibly in an extension, though that’s fairly unlikely) is stepping on the parser’s ability to understand the ‘look’ command. Try searching your source text for ‘look’ and see what turns up.

Just get a blank line and a new cursor. Will try what you said. Thanks.

Just did what Jim Aikin suggested. Here’s the only code I wrote dealing with looking:

Instead of looking: say “[if player is on Desk and stepladder is on Desk]You and the ladder are on top of the desk.”

Instead of looking:
if player is on stepladder:
say “Your torso is halfway above the top step of the stepladder, and you sense that to limb any higher would be extremely dangerous.”;
otherwise:
continue the action.

In another section of code, I wrote:

The weird-looking electrical equipment is a thing. It is in Westside.

But I don’t see how that might interfere.

You have two instead-of-looking rules, both of which are active in your code? That may be a recipe for trouble, right there. But as I said, the first of those rules will always produce a blank line of output unless the condition is fulfilled. I don’t know what the compiler will do if it sees two instead-of-looking rules, but if I were you I would certainly try reorganizing this code so that it’s all a single rule. (The electrical equipment isn’t an issue.)

If you see a blank line even when both the player and the stepladder are on the desk, then there’s something funny about the syntax of your if-clause. My Inform is extremely rusty, but I would suggest trying [if player is on Desk and if stepladder is on Desk]. That might not compile – or it might solve the problem.

There’s something very important you have to understand:

By writing “Instead of looking”, you have completely captured and redirected the looking action. Every time that you “look”, Inform finds your “Instead of looking” rule and prints that instead of the usual rulebook.

And with your first rule it’s doing exactly what you told it to: if the player and the stepladder are on the desk, it will display that message upon typing “look”, instead of the usual room description. If those conditions aren’t met, however - then it knows it has to say something, because you told it to, but not what.

The second rule, at a glance, seems more reasonable, what with “continue the action” and all.

I’m not sure I’d do it this way, but since it’s how you chose to do it, try something more like:

Instead of looking: if player is on Desk and stepladder is on Desk: say "You and the ladder are on top of the desk."; otherwise if player is on stepladder: say "Your torso is halfway above the top step of the stepladder, and you sense that to limb any higher would be extremely dangerous."; otherwise continue the action.

Untested, and my practical I7 is rusty, but this should give you the gist of why it’s not working.

EDIT - Jim beat me to the punch!

That cleared up some of the problem, but still doesn’t get me the view from the desk or the ladder, just the room description.

Are there not enough indents in that code?

Probably the most elegant way to do this is to put the condition in the rule preamble.

Instead of looking when the player is in the stepladder: say "You are on a stepladder."

(Depending on how you have implemented the stepladder, you might need “on”, “in”, or “enclosed by”; “in” seems the most likely but without seeing your code I don’t know.)

Did that. Now I’m back to the original problem: parser ignores me and just prints a cursor.

Bottom line: Something in your code has been written wrongly. Without seeing all of the actual code, it’s very difficult for us to provide a solution. It’s not at all clear (to me, anyhow) that you’re applying the suggested solutions in a systematic and orderly manner. If you’re still getting the original problem, that strongly suggests that you’re trying to apply our suggestions piecemeal rather than stepping back and taking a close look at what’s going on.

I’m pretty sure there are some good explanations in the documentation about how to write instead rules, and what an instead rule does. You may want to try re-reading that material. After which, put all of your code relating to the looking action in one place so you can inspect it line by line, looking for logical inconsistencies. Then, if that doesn’t suggest the solution, post the entire block of code (using the [Code] button in the web interface) so we can look at it.

I will do that. I appreciate all the answers I’ve gotten.

I have to say, with all the discussion this project is generating, I really want to play this thing when it’s done. :slight_smile:

:mrgreen:

Would you like to beta test?

I bleeb I gots it figured. Thanks to all.

This should be a check looking, not instead.

Check looking:
If the player is…
Say “…” instead.