After the battle ends set a var to 1.
In the random battle code, check if the var is 1. If it's set, do nothing. If it isn't set, do a random battle. After the random battle code, set the var back to 0 (to make it possible to do battles).
If you want more steps between battles, do the same only set the var to a higher number, and instead of setting the var to 0, subtract 1 from the var (if you do if var <= 0 then it doesn't matter if the var is negative).
I hope you understand ^^ (well, I think you already figured it out on your own xD)