Perceptual melee radar
The highlighted comment was created in this revision.
I tried building a perceptual bot a while ago. The hardest problem I found was how to make a melee radar without storing any data and without accessing getScannedRobotEvents().
A second radar event in the same tick overrides the first and the bot keeps changing targets. Didn´t find how to overcome this problem yet.
Not sure if this is what you are looking for, but you can use clearAllEvents() within the onScannedRobot(..) function. This clears all remaining scan events.
The problem is the last radar event overrides the others. With clearAllEvents() the first radar event overrides the others. In practice, both make perceptual bots change targets every tick in melee, and the performance is awful.
I was looking for something to lock onto the same target for many scans.