Thanks, it works perfectly.
And for anyone who has trouble with it, you have to show printable version.
Also the sky battle and inverse battles are the next 2 places like so:
"result = customTrainerBattle(trainer, "Oh no, you defeated me!",false,false,true,true)"...