trainerbattle 0x3 0xYYY 0x0 @intro @defeat
Iirc, trainerbattle 0x3 allows execution after the battle, even if you lose.
Sorry bro, but this is completely wrong. Trainerflags are cleared when you win, and trainerbattle 0x3 doesn't require a pounter to continue the script, however the wcript will NOT continue if you lose. The only trainerbattle that will continue is 0x9. However that is the tutorial battle which has all sprts of messaged which pop up, though woth a alittle work, they can be removed.
compare LASTRESULT 0x0
if 0x1 goto @Win
Yes, that is correct, for checking if you won of course.