Just a random battle battle script, you can change the numbers to make it get into a battle more frequently or less frequently. Just use A and D to walk back and forth and you eventually get into a battle. Once you're in space, every time the dude says "Let's fight!" is a battle.
Thanks to InternetUser_005 for helping me out with this. The script acts like a 13-sided die, but you can change it.