Instead of unscrewing the panel with the screwdriver[solved]

First post!

Hello. I’m just getting started with I7 and I’m loving it so far, but I’ve hit a snag and just don’t seem to be able to get past it. I’m writing a fairly basic one-room puzzler, it’s not original in any way and I doubt I’ll ever release it, I’m just honing my I7 skills with this story.

The story takes place in a jail cell. There’s a hacksaw conveniently hidden behind a metal panel in the cell door. The panel is screwed on. After a convoluted plot-turn you get a screwdriver which you then use to remove the screws on the panel. Simple, right? So here’s the code for unscrewing:

Screwing is an action applying to two things. [not like that, get your mind out of the gutter]

Understand "Screw [something] with [something]" as screwing. Understand "Unscrew [something] with [something]" as screwing. Understand "Remove [something] with [something]" as screwing.

Carry out screwing:
	If the second noun is screwdriver:
		If the noun is screws:
			Say "You unscrew the 8 screws holding the panel in place on the door. With a little persuasion it eventually drops from the door to reveal a hidden alcove with a rusty hacksaw in it. How rather convenient!";
			[then obviously make the hacksaw visible etc etc]

That’s fine, but I want the action to apply to either the panel (e.g. “unscrew the panel with the screwdriver”) or the screws themselves (e.g. “unscrew the screws with the screwdriver”).

I thought this would work:

Instead of screwing the panel:
	Try screwing the Screws.

But of course that doesn’t supply the second noun to the action. I’m not sure how to make the “instead” rule pass on the second noun. Can anyone help? It seems such a trivial thing, but I’ve spent hours trying to figure this out and just can’t find any similar examples anywhere (which seems weird in itself, I’d have thought this would be a relatively common scenario). Any help would be greatly appreciated!

What about:

Instead of screwing the panel with something, try screwing the screws with the second noun.

(Anybody seeing this out of context could get some very strange ideas about what’s going on.)

Robert Rothman

Couple things:

I think you need to define the action thus:

Screwing it with is an action applying to two things. Understand "screw [something] with [something]" as screwing it with. [etc.]

The “it” tells Inform where the first noun is expected to go. (This is mentioned somewhat offhand in section 12.7 of the documentation.) That’s how it knows that the action is “screwing the panel with the screwdriver” rather than some other preposition. (I mean, when you refer to the action in your source code, not when the player types it.)

Then this (as Robert points out) will work:

Instead of screwing the panel with something: try screwing the screws with the second noun.

I think that in rule headers involving an action applying to two things, you have to mention both nouns or neither. So “instead of screwing” compiles, but “instead of screwing the panel” doesn’t.

Some other things to watch out for: “screw” and “unscrew” are already built in as synonyms for “turn”; your code doesn’t interfere with that because turning only applies to one thing, but it’ll yield a misleading message if the player tried “UNSCREW PANEL” without supplying a “with.” You might be able to get around this by blocking turning the screws with a message telling the player to say what he’s unscrewing them with. Also, you need to supply something for your carry out unscrewing rule to handle the cases when the player has typed “Unscrew me with screws” or something – as it is that will simply return a blank command prompt. You might also want to force the player to be holding the screwdriver rather than just having it lying around (though it might be courteous to automate picking up the screwdriver).

Ah splendid, that’s done it!

Yes I’d already spotted this and had made a mental note to fix it later :slight_smile: Right now I’m just trying to get a skeleton of a game, true spit and polish will be done once the game is playable to completion. I just really wanted to get this one thing working because my personal inclination would be to “unscrew panel with the screwdriver” which gave an unhelpful message before. If I can’t figure out my own game then what chance does anyone else have? heheh.

Yep, true.

This is actually the next thing I planned to implement. As is there’s little checking of that sort of thing meaning the game can be completed without actually having discovered the screwdriver (for example).

Thanks for your help both! In case anyone else should run into this problem, here’s the full complete solution:

[code]Screwing it with is an action applying to two things. [not like that, get your mind out of the gutter]

Understand “Screw [something] with [something]” as screwing it with. Understand “Unscrew [something] with [something]” as screwing it with. Understand “Remove [something] with [something]” as screwing it with.

Carry out screwing it with:
If the second noun is screwdriver:
If the noun is screws:
Say “You unscrew the 8 screws holding the panel in place on the door. With a little persuasion it eventually drops from the door to reveal a hidden alcove with a rusty hacksaw in it. How rather convenient!”;
[then obviously make the hacksaw visible etc etc]

Instead of screwing the panel with something:
Try screwing the Screws with the second noun.[/code]

It sounds like you’re all set now, but for future reference: the first couple sections of the “commands” chapter in the recipe book are meant to provide an overview of designing and implementing new actions in a step by step way, with some examples and then pointers to where in the main manual to seek more information for each portion.

You can mention only the first noun in this case, too; but then you need to follow up with the preposition as well: “instead of screwing the panel with” compiles (and, I think, means the same as “instead of screwing the panel with something”).