Getting the PC to take over a command for an NPC?

I’d like to get my PC to do any parser commands given to an NPC in certain circumstances, but I’m having trouble figuring out what the syntax would be. Maybe something with a stored action? Anyway, here’s about what I would expect the code to be:

Check asking someone to try doing something: if the noun is incompetent: say "Actually, let me do that, since you'll just mess it up."; [TRY DOING THE ACTION YOURSELF];

I appreciate any help!

Well, my first guess was that you could use Editable Stored Actions by Ron Newcomb. Except I’m damned if I can see why this doesn’t work:

[code]Include Editable Stored Actions by Ron Newcomb.

Bootcamp is a room. Gomer is a man in Bootcamp. Milo is a man in Bootcamp. A person can be competent or incompetent. Gomer is incompetent. Milo is competent. A button is in Bootcamp. A rock is in bootcamp.

The new action is a stored action that varies.

Instead of asking someone to try doing something when the actor part of the current action is incompetent:
say “[The person asked] looks befuddled, so you try it yourself.”;
let the new action be a stored action;
now the new action is the current action;
change the actor part of the new action to yourself;
try the new action.

Persuasion rule: persuasion succeeds.

test me with “gomer, get rock/i/l”. [/code]

…especially because it does work when you write “change the actor part of the new action to Milo” – then Milo will do whatever you ask Gomer to do. (But if you add “The player is Milo” that breaks it again.) I will send Ron a batsignal.

Awesome, I appreciate you looking into it.

Matt’s code works fine, if you add a line to turn the new action from being a request for an action to being that action pure and simple:

Instead of asking someone to try doing something when the actor part of
	the current action is incompetent:
	say "[The person asked] looks befuddled, so you try it yourself.";
	let the new action be a stored action;
	now the new action is the current action;
	change the request part of the new action to false;   	   [You need this line, too!]
	change the actor part of the new action to yourself;
	try the new action.

(I can’t explain just what the parser does with Matt’s original code: the ACTIONS debug command says that the player succeeds in taking the stone; and, while the standard rules for taking seem to be bypassed, custom rules for taking in your own source texts do run as expected …)

Thank you, Felix! That’s what I was missing (and rereading the Editable Stored Actions documentation makes it clear). And now you don’t need “Persuasion succeeds,” and I think you may be able to change “the actor part of the current action” back to “the person asked” (something I was trying before made that loop infinitely).

One thing to be aware of is what happens when you type “Gomer, get rock/Gomer, drop rock”.

I wonder if Commissioner Gordon ever said, “Oh, nevermind. We figured it out.”

Oh, another thing to note is that you don’t need “A new action is a stored action that varies,” since “the new action” is actually getting defined as a local variable. That’s legacy from when I was thrashing around changing things and trying to figure out what was going wrong.

Awesome, thanks so much! I will try this out right away.

And lol @Ron.