Help with an action please!

Here’s the code I have:
The Prisoner is a person in Hostage Barracks. Understand “Prisoner/Jon D” as Prisoner.

Instead of asking Prisoner about “name/his name”: say “[if Scene 4 ended happily] ‘My name is Jon D. Who are you?’ Something clicks in your brain. He has a name. He has a life, one he’s barely begun to live yet. And you are going to end that life.[otherwise] ‘I’m Jon D. Who are you?’”.
Instead of telling Prisoner about “self/you/name”: say “[if Scene 4 ended happily] ‘It doesn’t matter.’[otherwise] It doesn’t matter, I was sent by Gang 1 but we don’t have much time.’”.

Killing is an action applying to one thing. Understand “kill [someone]” as killing.

Instead of killing Prisoner: say “[if Scene 4 ended happily] You look at the table. A slew of devices lay on the table. Your eyes pass the more gruesome objects until they fall upon a sharp knife. You pick it up and take a deep breath. The prisoner’s eyes have lost that spark of life again. As you place the knife at his neck, you think about apologizing but what good would that do? You close your eyes and move your arm in a jerky motion, slitting the man’s throat. You open your eyes and see a lifeless body. A glowing orb is rising out of the body’s chest and floating near your hands. You close your fingers over the object, orange light penetrating through the gaps, and take it.”
After killing Prisoner: say “Now the Prisoner is dead.”.

The game compiles and plays but when I get to this point and try to ask the prisoner anything it goes with the default “there is no reply”. Same for attempting to kill the prisoner, it just says “violence isn’t the answer to this one”. Any help would be greatly appreciated!

The rule ‘Instead of asking Prisoner about “name/his name”’ only tells Inform how to react to the commands ASK PRISONER ABOUT HIS NAME and ASK PRISONER ABOUT NAME NAME; it does not give the game a rule for what to do on ASK PRISONER ABOUT NAME. This is because “name/his name” means “name name” or “his name” and not “name” or “his name”. See documentation ch. 16.13.

“Kill” is a default synonym for “attack”. If you don’t necessarily need different killing and attacking actions, the easy thing is not to define a new killing action and to make those last two rules ‘instead of attacking’ and ‘after attacking’ rules instead.

If you do want to distinguish between attacking and killing, you need to add the line ‘Understand the command “kill” as something new.’ before the line ‘Understand “kill [something]” as killing.’.

I’d also like to point out that if Scene 4 has not ended happily, you’re going to see some blank responses to commands.

Additionally, an After rule will not run if an Instead rule has stopped the action, which Instead rules do by default.

I think what you probably want is to add “when Scene 4 has ended happily” in the preamble for the relevant rules. Alternatively, you can say “if scene 4 has ended happily, continue the action” within the rule.