Code: Select all
; Get the destination. It should be a friendly structure
(setq destList (sysFindObject gSource "T:populated;F"))
; Find the farthest station (start with min distance)
(setq minDist (item gMission 4))
(setq bestDist 1200)
(setq gDestination Nil)
(enum destList testDest
(if (and
(gr (objGetDistance gSource testDest) minDist)
(ls (objGetDistance gSource testDest) bestDist))
(block Nil
(setq bestDist (objGetDistance gSource testDest))
(setq gDestination testDest)
)
)
)
It works fine, but if it was coded more like this:
Code: Select all
; Get the destination. It should be a random friendly structure between minDist and maxDist
(setq gDestination Nil)
(setq minDist (item gMission 4))
(for i 2 7
(if (not gDestination)
(block (maxDist)
(setq maxDist (multiply minDist i))
(setq gDestination (random (sysFindObject gSource "T:populated;F;A;N:minDist;R:maxDist"))
)
)
)