Background: When the player fights a trainer and loses, the trainer's flag remains cleared. When the player fights a trainer and wins, the trainer's flag is set. I often use the checktrainerflag command to determine if the player won or lost some past battle.
Problem: After 2 hours of attempts, I've come to realize that your ASM routine actually sets a trainer's flag regardless of whether the player won or lost the battle. This is bad, since I can no longer act on the result of a trainer battle.
Question: To your knowledge, is there any way to know if the player won or lost a battle after returning to the overworld? Possibly a byte I could reference?