Hi,
I’m getting into writing my first IF game; a small detective story that let’s me muck about, write something (hopefully) fun and learn how this Inform 7 malakey works. So far I’ve managed to brute-force my way through any coding problems, but I’m stumped by this one, and figured maybe someone here would be able to offer some suggestions.
In my game, most NPCs aren’t readily available to talk to. You have to examine scenery, and then you take note of them. This is what I wrote to account for this, which has worked pretty well:
[code]An NPC is a kind of person. An NPC is usually scenery. Before examining NPC (called the target): Now the target is not scenery.
The gambling den is a room with the description “The den is a single open hall, packed with gamblers.”
Harry Balls is a male NPC in the gambling den with the description “[one of]The gamblers stare intently at their cards; a single older gentleman catches your eye.[or]An affable older gentleman reclines with his cards held almost disparagingly in front of him.[stop]” Understand “gambler”, “gamblers”, “approachable”, “approachable gambler” as Harry Balls. Harry Balls has the printed name “an approachable gambler”.[/code]
In conversation, he’ll give his name which will change the printed name to Harry Balls.
There are a couple of problems with this code. First off, what if the player wants to examine the other gamblers after Harry makes an appearance? Second, I don’t want the key to the walkthrough to be ‘enter the gambling den and type “talk to Harry”,’ when there is no Harry there. Without the step of finding Harry that’ll just seem really cheap.
So I’m trying to write a piece of code that will link an NPC to a piece of scenery; the NPC will be off-stage until the player examines the scenery, at which point he’ll be placed in the room.
I’ve tried a bunch of different ways of doing things, and here’s what I’ve got right now:
[code]NPC grabber is a kind of thing. NPC grabber has a person called designated NPC. An NPC grabber is usually scenery.
After examining the NPC grabber (called the target):
If designated NPC is off-stage:
Say “[paragraph break]A [designated NPC] catches your eye.”;
Move the designated NPC to the target.
Gambling den is a room.
Gamblers are an NPC grabber in the Gambling den with the description “The gamblers stare intently at their cards.” The designated NPC of gamblers is Harry Balls.
Harry Balls is a man with the description “yo.” [/code]
But that doesn’t seem to work. Can someone help me figure this one out, or show me how to write something that will do what I want?