@Heirukichi and
@Trihan I think I may have done a couple of things wrong.
I created the skill and gave it a particular animation and called the common event. Nothing else. In the common I put the main code (first Heirukichi's, then on another attempt Trihan's). In order to check that code was working okay, I put a bit of dialogue text. I then put the second piece of code, exactly as shown but instead of 'skill'. I put the skill id.
The common event is called - however, the enemy does a small attack at
that point. It appears to be random who gets targetted at this stage. I know this is happening because the animation shows, and 1HP damage is done. (I have a snippet which ensures that 1HP is always the minimum, to avoid the Null thing.) The test dialogue appears, and then the common event tries to run the second piece of code. At which point I get the usual error message
Sigh. I know I'm a scripting idiot. What have I done wrong?