Making action apply to player

I’m trying to make an action, “step aside,” applicable to the player, but I note that actions can only apply to things or to kinds of value. How I do this?

Here’s what I tried to do and the result.

[code]Understand “step aside” as stepping aside.

Every turn:
if the lady on horseback is in location and command is anything but step aside:
say “The lady on horseback recognizes you as Robin Hood, and reminds you of your vow to respect all women. You are so shamed that you fall into a deep melancholy, forgetting all else. When you pull yourself out of the dark humor, it is the next day and you realize that Marian is doomed. You fall back into melancholly and die.”;
end the story. [/code]

Problem message:

Problem. In the sentence ‘if the lady on horseback is in location and command is anything but step aside’ , I was expecting that ‘lady on horseback is in location and command is anything but step aside’ would be a condition. It didn’t make sense as one long phrase, but because it was divided up by ‘and’/‘or’, I tried breaking it down into smaller conditions, but that didn’t work either. ‘lady on horseback is in location’ was okay; ‘command is anything but step aside’ did not make sense; so I ran out of ideas.

I was trying to match this phrase:

if (lady on horseback is in location and command is anything but step aside - a condition):

But I didn’t recognise ‘lady on horseback is in location and command is anything but step aside’.

Instead of doing anything except stepping aside in the presence of the lady on horseback…

I tried this:

Every turn: Instead of doing anything except stepping aside in the presence of the lady on horseback: say "The lady on horseback recognizes you as Robin Hood, and reminds you of your vow to respect all women. You are so shamed that you fall into a deep melancholy, forgetting all else. When you pull yourself out of the dark humor, it is the next day and you realize that Marian is doomed. You fall back into melancholly and die."; end the story.

Got this:

Problem. You wrote ‘Every turn’ : but there doesn’t seem to be any definition here, so I can’t see what this rule or phrase would do.

You’re trying to put an “instead” rule inside an “every turn” rule.

OK, I think I get it. Thanks.

Now THIS was an unexpected development:

Instead of doing anything except stepping aside in the presence of the lady on horseback: say "The lady on horseback recognizes you as Robin Hood, and reminds you of your vow to respect all women. You are so shamed that you fall into a deep melancholy, forgetting all else. When you pull yourself out of the dark humor, it is the next day and you realize that Marian is doomed. You fall back into melancholly and die."; end the story.

Transcript:

You wake up and look into the sky. 'Tis well after dawn, but that’s not unusual for one who wears the Lincoln green.
Although you are stiff from spending the night on the ground, you slept well, dreaming of the Merry Men and all their adventures and frolics.
In one dream in particular, you recalled the day Much the miller’s son climbed the Gallows Oak and hung down from one of its limbs by the hands until Little John, unaware of the jest, stood directly below him. Much let go, landing on John’s back as if 'twere a horse’s saddle, and the two romped around the forest to your directions like a two-headed beast, much to the merriment of the men!
You are at the edge of the great forest of Sherwood, underneath some bushes so that you cannot be seen from the road. And who knows who might be trodding down that road: a fat archbishop, his fingers dazzling with rings; an emaciated peasant, tired and haggard from the constant work demanded by his liege; the deputies of the hated Sheriff of Nottingham?
And e’en now you hear approaching footsteps!
Oh, 'tis only Will.

Marian’s Peril
An adventure of Robin Hood and his Merry Men. Not to mention Marian, maid deluxe. by Daun Eierdam
Release 1 / Serial number 150512 / Inform 7 build 6L38 (I6/v6.33 lib 6/12N) SD

The lady on horseback recognizes you as Robin Hood, and reminds you of your vow to respect all women. You are so shamed that you fall into a deep melancholy, forgetting all else. When you pull yourself out of the dark humor, it is the next day and you realize that Marian is doomed. You fall back into melancholly and die.

*** The End ***

I think there’s an automatic ‘look’ command when the game opens, which is used to describe the room. I could be wrong, but if this is the very first command in the room that creates a win/lose state, the parser might be automatically triggering your script with a hidden opening move.

Craftian is right. You should probably add “looking” to that rule.

Instead of doing anything other than looking or stepping aside...

I’d forgotten the game used that action to generate the initial room description.

The beginning room is called “Bushes,” and “Great Northern Road” is to the west of it. An initial “look” command should describe “Bushes.”

My guess, untested, is this. You have “Instead of doing anything except stepping aside in the presence of the lady on horseback:”. Possibly the compiler is interpreting this as “Instead of doing anything except (stepping aside in the presence of the lady on horseback):” In this situation, possibly an initial, automatic LOOK action would be intercepted by the instead rule. What you want, I would assume, is “Instead of doing anything except stepping aside (in the presence of the lady on horseback):” I have no idea if the parentheses will compile – probably not.

If I’m guessing right, the solution would be to test for the presence of the lady within the Instead rule rather than in the heading of it:

Instead of doing anything except stepping aside: if the lady on horseback is in the location: say "The lady on horseback recognizes you as Robin Hood, and reminds you of your vow to respect all women. You are so shamed that you fall into a deep melancholy, forgetting all else. When you pull yourself out of the dark humor, it is the next day and you realize that Marian is doomed. You fall back into melancholly and die."; end the story; else: continue the action.
I could well be wrong about this – just thinking out loud. But it’s worth a try.

Not in this case – you used ‘Instead’ as the head of your function. The hidden ‘look’ command is triggering your ‘Instead’ code, and then ending the function with ‘end the story’, which is preventing the hidden look command from executing. This is similar to using ‘stop the action’ at the end of a function, which prevents Inform’s stock responses from printing out, so you can use custom responses. Print the room description, and print the name of the room are hidden aspects of the look command, and so that is the first command the game begins with.

(Edit)
Like Jim said. :smiley:

But the initial room is “Bushes,” not “Great Northern Road,” which is to the west of “Bushes.”

Maybe I’m missing something, here – is this scene supposed to happen in the opening room, or to the west of it?

(Edit)
In this case, Jim’s solution will probably fix the bug:

That should fix it if the player starts in the bushes, but is somehow being seen right off the bat.

Play starts in the Bushes, and you should have to tell the parser to go west before you encounter the lady.
But in fact the lady is only one of five characters randomly chosen to appear in the Great Northern Road room. I7 is bypassing all that.

Instead of doing anything except stepping aside in the presence of the lady on horseback: say "The lady on horseback recognizes you as Robin Hood, and reminds you of your vow to respect all women. You are so shamed that you fall into a deep melancholy, forgetting all else. When you pull yourself out of the dark humor, it is the next day and you realize that Marian is doomed. You fall back into melancholly and die."; end the story.

For some reason the ‘presence of the lady on horseback’ is missing that the player isn’t in the ‘Great Northern Room’. I would try:

Instead of doing anything except stepping aside in the presence of the lady on horseback: If the player is in the location of Great Northern Room: say "The lady on horseback recognizes you as Robin Hood, and reminds you of your vow to respect all women. You are so shamed that you fall into a deep melancholy, forgetting all else. When you pull yourself out of the dark humor, it is the next day and you realize that Marian is doomed. You fall back into melancholly and die."; end the story.

Worth a shot.

The thing that Jim was saying is that this:

Instead of doing anything except stepping aside in the presence of the lady on horseback:

has two possible parsings. We want it to do this:

Instead of doing (anything except stepping aside) (in the presence of the lady on horseback):

so the rule fires whenever you’re in the presence of the lady and you do something other than step aside. But it looks like Inform is interpreting it like this:

Instead of doing anything except (stepping aside in the presence of the lady on horseback):

so it fires when the current action is anything except stepping aside in the presence of the lady on horseback. So the initial looking action gets caught by this even though the lady isn’t there (in fact, especially because the lady isn’t there).

If that’s what’s happening, you need to change the header of the rule. As Jim said one way to do this is to put one condition in the header of the rule and test for the other within the rule, with a “continue the action” in the otherwise clause so it doesn’t stop every action. His code should work.

By the way, unless the command “step aside” is hinted VERY well this will be a really annoying puzzle.

According to my beta testers, ALL my puzzles are annoying. But thanks for clearing the above up.

I see what you mean, though. Instead of ending the story, I think I’ll just make the player hang fire until he or she figures out what to do.

The thing is that, even if the player realizes they have to step aside or show courtesy to the lady in some way, it’s fairly unlikely that the player will hit on the phrase “step aside” on their own. So a big part of your job is to communicate that to them so they feel like it’s fair. It’s not even so much the instadeath–if the game ends with a helpful message they can just “undo”–it’s the feeling of being brickwalled without a hint as to what to do next.

Moonbase Indigo is a good game to check out for ideas on how to do this. It has a lot of commands that aren’t in the standard IF toolkit but it does a good job of communicating them to the player.