Returns the distance to a specified object.
object expression.DistTo (Object)
object expression Required. An object expression that evaluates to an object in the Applies To list.
Object Required VObject. An object of type Bot, Cell, or VPoint.
When the Bounds property of the Screen object is set to wrapped mode, the calculated distance to an object is the shortest of all possible paths after accounting for wrapping around each of the Screen display edges.
The following example uses the DistTo method to determine the distance to a nearby Bot object. If the distance is less than 20, then the TurnAwayFrom method is used to take evasive action.
dist = Bot.DistTo otherBot
If dist< 20 Then Bot.TurnAwayFrom otherBot