Unfortunately, that's not possible with the default battle system. I ran into this problem when I was doing the first version of Dark Age. As sort of a way around, I made a story sequence that looked like a battle: the characters "attacked" the enemy automatically before getting blown away (heh...). Not exactly the same as controlling the characters before losing, but it gives a similar effect.
Hmmm...
Actually I just had an idea... Try setting this as your "game over" program in the main file editor:
#if(loss_program$="")
{
#run("GameOver.prg") *This is your normal loss program
}
#if(loss_program$~="")
{
#run(loss_program$)
}
Now try setting loss_program$ to the name of the program you want to run when the player loses, right before the battle, i.e.
#loss_program$="defeated_by_dragon.prg"
#fightenemy( ... )
I'm not sure it that'll work (haven't messed with the default battle system in years), so let me know!