Redirecting all commands into instructions for an NPC

I’m working on a project that models talking to NPCs on the radio so the player can instruct characters in another location to do things. The idea I had was to allow for some commands to start and stop radioing another character (similar to the section on telephones in the Inform documentation), and then whenever the player is having a conversation with someone, they can type normal commands and they will be interpreted as instructions for the character they are talking to.

Here’s how I imagine it to work:

>radio john
You tap on the mic and lean in. "John, this is HQ, do you copy?" After a few moments his response is picked up by the receiver. "This is John, go ahead HQ."

>l
"Can you tell me what you're seeing John?"

"I'm over by the old public docks near the cove. The beach runs along to the north, and I can barely see the tree line to the east from the water. I've got the Jeep parked in the lot to the south."

"The weather is beautiful out here today, by the way," he adds. "I'm glad I'm not cooped up in the office like you." You wrinkle your nose as you hear him chuckle.

>x docks
"They're run down as ever; I think a couple more boards have fallen off into the ocean since I was last here. We really need to rope off this area."

I thought of a couple different ways of doing this, but there are drawbacks to each and I’m just wondering what people think would be best (I’m not particularly experienced with writing IF):

  • Use an “After reading command” rule to change the command to “[the person being radioied], [the player’s command]”. This literally turns each typed command into an ask action. Issues are I have to untransform any meta-radioing commands (like hanging up) since I can’t tell what they are before they’re parsed, and I’m not sure what happens when someone types a command that is already an ask action (so it ends up as “John, Kate, x trees”). This is what I have now and it seems to work but I feel like I’m going to hit unforseen issues. Positives are that I can easily write report rules for NPC actions with whatever conditions I want, and everything goes through persuasion rules in case I want to use those.
  • Parsing the action and then changing the person asked to the person being radioied in a “before doing anything” rule. The nice thing about this is that I can run an activity from that rule so that I can distinguish between the player radioing someone to do something and the player asking in person or the NPC doing stuff on their own. I couldn’t really get this to work all that well though…
  • Just forget all of this try asking trying doing something stuff and switch the viewpoint character to the person being radioed. Changing action reporting makes it seem to the player like you’re talking with this character on the radio, but the game just interprets your commands normally because you’re actually that other character. I also don’t have to worry about changing scope, although I think I’ve figured that out at this point anyway. This might be easiest in the end, but I wanted to give the more “true to the story” approach a shot.

Any ideas on this one? Thanks for your help!

Use Editable Stored Actions by Ron Newcomb. This will allow you, in the relevant parts of the story, to intercept whatever action the player has typed in (maybe in a First Before rule, which gets in before anything else can work) and change the actor to the person you’re talking to. Though you still have to be careful to make sure everything’s in scope (and maybe use reaching inside rules) so that things don’t get messed up before the command is fully parsed. You can even convert the actions into requests (change the “request part” of the action before you try it).

…I guess this is your second option, and what I’m telling you is that the way to get this done is with that extension.

But really, your third option is probably the best–if the NPC is going to be performing every typed action, just make him the viewpoint character and write the messages so as to preserve the radio fiction.

The third option would kind of be like LOST PIG, you end up rewriting every response in the game. Less would go wrong, but it’s work.

Reminds me of Suspended, which is really cool—I’ve been waiting for more games to use that idea. I’d say the third option is the best: there’ll be a decent amount of response rewriting, but in new versions of Inform you can just make third-person-singular the default to cover most of them.

Honestly, I’m not sure that rewriting every response for the third option would be any more work than putting in all the messages to make things work smoothly for the first or second option. You’d be writing all the same things but putting them in a different place. And in the second option you’d have to do a lot of messing around with Unsuccessful Attempt rules, which can be more complicated than just rewriting all the messages.

In terms of responses I think they should all take basically the same amount of work, since the effect to the player is meant to be the same regardless of the implementation. But I think you’re right that the third option gives the most flexibility, and I will just be adding the character’s name to all of my action rules (e.g. Before John examining trees…).