This is really basic but could be helpful for people who are interested in running DScan while they are hunting/mining. I have set up my Dscan so that if any entry shows up I want my script to leave.
My issue was figuring out how to send the scan command intermittently. I managed to find a way using
rampRotationMilli
. Right now this snippet uses mining modules but I might use my tank module instead for a more reliable timer.
case context |> knownMiningModules |> List.filter (.isActive >> Maybe.withDefault False) |> List.head of
Nothing ->
waitForProgressInGame
Just activeModule ->
if ((activeModule.rampRotationMilli |> Maybe.withDefault 0) |> modBy 50) > 25 then
describeBranch "Dscanning"
(decideActionForCurrentStep
[ EffectOnWindow.KeyDown EffectOnWindow.vkey_V
, EffectOnWindow.KeyUp EffectOnWindow.vkey_V
]
)
else
....
Here is the part the look for entries in dscan. I’d like to filter the result down the line but this is the beginning.
case context.readingFromGameClient.directionalScannerWindow of
Nothing ->
describeBranch "Opening directional scanner window."
(decideActionForCurrentStep
[ EffectOnWindow.KeyDown EffectOnWindow.vkey_V
, EffectOnWindow.KeyUp EffectOnWindow.vkey_V
]
)
Just dscanWindow ->
if (dscanWindow.scanResults |> List.length) > 0 then
describeBranch "Enemies in dscan range. Leaving"
(returnDronesToBay context
|> Maybe.withDefault (warpToRandomBelt context)
)
else
....