Sends out a radar ping in the direction of the robot's radar. The ping travels in a straight line away from the robot. The distance of the first obstacle encountered is placed in the _scandist and _scandistfc system variables. Obstacles that can be detected by radar are other robots, cookies, mines, and walls. Energy missiles can not be detected by radar.
The maximum distance a robot's radar can detect obstacles is control by the radar range setting of a match. Radar range is set under that Advanced tab of the New Match window. A robot can determine the maximum radar range for the current match by examining the _radarrange system variable. If no obstacle is detected closer than the maximum range _scandist and _scandistfc are filled with the maximum range.
When the scan command is called, several system variables are updated to provide information about the result. If something is detected its type can be determined by examining the _dtcrobot, _dtcmine, _dtccookie, and _dtcwall system variables. When scan detects an obstacle one of these variables is increased by one while the others are set to zero. If nothing was detected, all of these variables are set to zero. Each time scan is called the following variables are also set: _dtcenergy, _dtcheading, _dtcid, and _dtcteamid.
When scan detects an obstacle and a detection event handler was registered for the detected type, the handler is called after the scan. See event summar topic for a list of event handler commands.
_scandist, _scandistfc, _radarrange, _dtcrobot, _dtcmine, _ dtccookie, _dtcwall, _dtcenergy, _dtcheading, _dtcid, _dtcteamid