Why don't you use the regular escape function? If that is only because the regular escape is AGI based and you want a guaranteed escape, then Shaz's solution is OK.
However, if you're using a battlescript that has disabled that function for whatever reason, then different methods of aborting battles might also have problems...