After all these years of lurking around the forums and fantasizing about writing my first IF piece (which will be great, believe me )… I’ve finally started doing it. And stumbled across the first small problems (Hey, this isn’t as easy as I thought it would be).
The initial rooms of my story are actually not rooms, but outdoor locations in a rather open environment. So some of the objects that I implement in one “room” I do also mention in the descriptions of adjacent locations. I want the player to be able to reference those objects, so he doesn’t get the “You can’t see such a thing here.” answer, because that would be silly considering the room description just mentioned (e. g.) the meadow to the west.
I’m not satisfied with using backdrops, because the objects should have a very distinct behavior in the rooms they’re actually in. In the adjacent rooms the player should be able to reference them, but only get a rather generic answer, prompting him to go into a certain direction.
I hope I could make myself clear (sorry, English not my language of play in real life).
What I tried is the following code:
A thing can be eye-catching.
Definition: a thing is neighbour if it is eye-catching and it is in a room adjacent to the location.
After deciding the scope of the player:
repeat with X running through neighbour things:
place X in scope.
A Before Rule:
if the noun is a neighbour thing:
let X be the location of the noun;
let Y be the best route from the location to X;
say "[The noun] is [Y] from here. You need to go there to have a closer look.";
stop the action;
if the second noun is a neighbour thing:
let X be the location of the second noun;
let Y be the best route from the location to X;
say "[The second noun] is [Y] from here. You need to go there to have a closer look.";
stop the action.
Pasture is a room. "Yummy green grassy meadow! There's a hut to the east.".
The Meadow is a eye-catching thing in Pasture. The description is "Yummy!".
At the hut is east of Pasture. "You're standing in front of a hut. To the west you can see a meadow.".
Test me with "x meadow / east / x meadow".
This works but I am unsure if this is the best way to do it. Isn’t it bad style to have such a generic Before rule that will fire without any conditions? Any better way to solve this problem?
(by the way, I’m using I7-6G60 and the actual game is in German using the language extension by Team GerX)
Looking forward to your answers. Thank you!