Looks like I fixed both issues. Just did some clean up taking out empty lines, took out a few tray tips.
Booster is scanning and reporting hostiles.
Miner is scanning, mining and reporting hostiles.
Warning: Spoiler! ;`::
;*************************** To Do ************************************
; *Log hostiles found with time--- DONE, but gets mixed up with multiples
; *Get intHostilesFound at beginning and act on it--- DONE
; Clear hostiles at some point
;
;If (intSharedGroupNum<>intLocalGroupNum){
; If (boolIsLeader=true){
; IniWrite, %intLocalGroupNum%, %strSharedSettingsPath%, GroupVars, GroupNum
; }
; Else{
; ; EWO, at POS use EP modules to leave and rejoin group {Need to define INI variable for EP to pick up on this and have it bypass custom flow and go to normal EWO}}
; IniWrite, %intSharedGroupNum%, %strLocalSettingsIni%, GroupVars, GroupNum
; }
;}
;***************************************************************
;******************** EPResults *****************************
;* 0 = Error
;* 1 = Emergency Warp Out (Hostiles)
;* 2 = All Clear
;* 3
;* 4
;* 5
;
; SETUP: Make scanner only find player ships. Nothing else is implemented
;
; NOTES: Does not yet account for when other bots launch probes, because it was never implemented...
;***************************************************************
Global debug := False
Global strLocalSettingsIni := "????????\Scripts\LocalBotSettings.ini"
Global strSharedSettingsPath := "?????????\????\SharedDscan.ini" ; IF this is a shared folder then the folder needs to be opened automatically on boot of machine, configure windows to remember what windows were open on boot
Global strCurrentShip, strProbeNameType, intProbesDeployed, boolIsLeader
Global intHostilesFound, strUserInputShipName, strUserInputShipType, dScanData
Global intMinutesSinceHostile, TimeSharedLastUpdated, sharedHostileFoundTime, HostileFoundTime
Global intLocalGroupNum, intSharedGroupNum, intReportToEvePilot, friendlyShips, arryFriendlyShips
Global arryFriendlyShipLastUpdate, strCurrentShip, intSharedHostiles
Global ScanBtnPos1, ScanBtnPos2, DscanPos1, DscanPos2, POSPos1, POSPos2
Global maxHostiles := 5
;NEW Globals
Global intAllClear, intDanger, intInPod, intSleepMinutes
intInPod := 4
intAllClear := 2
intDanger := 1
intSleepMinutes := 35
WinWait, EVE - ,
IfWinNotActive, EVE - , , WinActivate, EVE - ,
WinWaitActive, EVE - ,
Random, randTime, 1, 12
Random, randPixel, 1, 3
SetDefaultMouseSpeed, 23
SetKeyDelay, 12, 22
SetMouseDelay, 5
CoordMode Mouse
; ########################### Verify Settings INI and prompt for setup if not exists ###########################
TrayTip, DScan, Checking Settings
CheckSettings()
GetVariables()
If (ShipDestroyed()){
IniWrite, %intDanger%, %strSharedSettingsPath%, EPResults, Result
IniWrite, %intInPod%, %strLocalSettingsIni%, EPResults, Result
}
CheckForSharedHostiles()
GetFriendlies()
CheckDScan()
ProcessResults()
ExitApp
; ########################### Procedures Only Below This Point ###########################
ShipDestroyed(){
shipDestroyed := False
IniRead, intLocalEvePilotResult, %strLocalSettingsIni%, EPResults, Result
If (intLocalEvePilotResult = intInPod){
;Sleep 1000 ; Sleep so that EP sees that this process ran
;intHostilesScanned := 1
;ProcessResults()
shipDestroyed := True
}
return shipDestroyed
}
;******************************************
;************************** Check shared INI for Hostiles ********************************
;******************************************
CheckForSharedHostiles(){
If (debug){
MsgBox CheckForSharedHostiles() intReportToEvePilot=%intReportToEvePilot% and intHostilesFound=%intHostilesFound%
}
intMinutesSinceHostile = %A_NowUTC% ;COLON screws it up
timePast := sharedHostileFoundTime
intMinutesSinceHostile -= %timePast%, Minutes
If (debug){
MsgBox sharedHostileFoundTime=%sharedHostileFoundTime% and intMinutesSinceHostile=%intMinutesSinceHostile%
}
HostileFoundTime := sharedHostileFoundTime
If (debug){
MsgBox intSharedHostiles = %intSharedHostiles% AND sharedHostileFoundTime is %intMinutesSinceHostile% minutes ago
}
If (intSharedHostiles > maxHostiles){
Sleep 1000 ; Sleep so that EP sees that this process ran
If (intMinutesSinceHostile < intSleepMinutes){
If (debug){
MsgBox intSharedHostiles = %intSharedHostiles% AND sharedHostileFoundTime < intSleepMinutes minutes ago. About to go to ProcessResults() to finish the program.
}
intHostilesFound := 0
If (debug){
MsgBox intHostilesFound=%intHostilesFound%
}
If (debug){
MsgBox Kept sharedHostileFoundTime of HostileFoundTime=%HostileFoundTime%
}
ProcessResults()
}
Else{
;RESET to All Clear
intHostilesFound := 0
intSharedHostiles := 0
intReportToEvePilot := 2
If (debug){
MsgBox Set ZEROED intHostilesFound/intSharedHostiles to = %intSharedHostiles% AND sharedHostileFoundTime is %intMinutesSinceHostile% minutes ago
}
}
}
}
;******************************************
;************************** Decide if Scan is Hostile=1 or Clear=2 ********************************
;******************************************
ProcessResults(){
If (debug){
MsgBox ProcessResults() INITIAL intReportToEvePilot=%intReportToEvePilot% and intHostilesFound=%intHostilesFound%
}
If (debug){
MsgBox ProcessResults() intHostilesFound=%intHostilesFound%
}
If (intHostilesFound > maxHostiles or (intSharedHostiles > maxHostiles and intMinutesSinceHostile < intSleepMinutes) ){
;* 1 = Emergency Warp Out (Hostiles)
intReportToEvePilot := 1
If (debug){
MsgBox ProcessResults() SHARED HOSTILES FOUND=%intHostilesFound%, intReportToEvePilot is 1=%intReportToEvePilot% and intHostilesFound=%intHostilesFound%
}
UpdateINIFiles()
ExitApp
; EmergencyWarpOut()
}
Else{
;* 2 = All Clear
intReportToEvePilot := 2
If (debug){
MsgBox ProcessResults() ALL CLEAR, intReportToEvePilot is 2=%intReportToEvePilot% and intHostilesFound=%intHostilesFound%
}
UpdateINIFiles()
}
If (debug){
MsgBox exiting with intReportToEvePilot=%intReportToEvePilot% and Hostiles=%intHostilesFound%
}
}
;******************************************
;************************** Write results to shared and local ini files ********************************
;******************************************
UpdateINIFiles(){
If (debug){
MsgBox UpdateINIFiles() intReportToEvePilot=%intReportToEvePilot% and intHostilesFound=%intHostilesFound% and intSharedHostiles=%intSharedHostiles%
}
intMinutesSinceUpdatedShared = %A_NowUTC% ;COLON screws it up
timePast := TimeSharedLastUpdated
intMinutesSinceUpdatedShared -= %timePast%, Minutes
If (debug){
MsgBox TimeSharedLastUpdated = %TimeSharedLastUpdated% and Now = %intMinutesSinceUpdatedShared%
}
If (intHostilesFound > maxHostiles){
TrayTip, DScan, Many hostiles found
If (debug){
MsgBox intHostilesFound > 0. Updating Local/Shared with EPResult, Hostiles, TImeHostileFound and listing hostiles in shared
}
boolUpdateLocal := True
IniWrite, %intReportToEvePilot%, %strLocalSettingsIni%, EPResults, Result
IniWrite, %intHostilesFound%, %strLocalSettingsIni%, DScan, Hostiles
IniWrite, %HostileFoundTime%, %strLocalSettingsIni%, DScan, HostileFoundTime
boolUpdateShared := True
IniWrite, %intHostilesFound%, %strSharedSettingsPath%, DScan, Hostiles
IniWrite, %intReportToEvePilot%, %strSharedSettingsPath%, EPResults, Result
IniWrite, %HostileFoundTime%, %strSharedSettingsPath%, DScan, HostileFoundTime
For k, v in dScanData
{
;MsgBox dScanData contents %k%=%v%
tempTime := A_NowUTC + k
IniWrite, %v%, %strSharedSettingsPath%, HostileClipboard, %tempTime%
}
}
If (intSharedHostiles > maxHostiles){
If (debug){
MsgBox intSharedHostiles > 0. Updating Local with EPResult, Hostiles, TImeHostileFound
}
boolUpdateLocal := True
IniWrite, %intReportToEvePilot%, %strLocalSettingsIni%, EPResults, Result
IniWrite, %intSharedHostiles%, %strLocalSettingsIni%, DScan, Hostiles
IniWrite, %HostileFoundTime%, %strLocalSettingsIni%, DScan, HostileFoundTime
boolUpdateShared := False
}
If (intMinutesSinceHostile > intSleepMinutes){
If (debug){
MsgBox intMinutesSinceHostile > intSleepMinutes. Updating Local/Shared with EPResult, Hostiles.
}
boolUpdateLocal := True
IniWrite, %intHostilesFound%, %strLocalSettingsIni%, DScan, Hostiles
IniWrite, %intReportToEvePilot%, %strLocalSettingsIni%, EPResults, Result
boolUpdateShared := True
IniWrite, %intHostilesFound%, %strSharedSettingsPath%, DScan, Hostiles
IniWrite, %intReportToEvePilot%, %strSharedSettingsPath%, EPResults, Result
}
If (intMinutesSinceUpdatedShared > 0){
If (debug){
MsgBox intMinutesSinceUpdatedShared > 0. Updating Local/Shared with CurrentShip and saving friendly ships locally.
}
boolUpdateLocal := True
IniWrite, %A_NowUTC%, %strLocalSettingsIni%, Friendlies, %strCurrentShip%
IniWrite, %A_NowUTC%, %strLocalSettingsIni%, GroupVars, TimeSharedLastUpdated
boolUpdateShared := True
IniWrite, %A_NowUTC%, %strSharedSettingsPath%, Friendlies, %strCurrentShip%
For k, strTmpFriendly in arryFriendlyShips
{
tmpFriendlyShipLastUpdate := arryFriendlyShipLastUpdate[k]
IniWrite, %tmpFriendlyShipLastUpdate%, %strLocalSettingsIni%, Friendlies, %strTmpFriendly%
}
}
}
;******************************************
;************************** Get D-Scan data from clipboard and concatenate name and type fields into dScanData array ********************************
;******************************************
CheckDScan()
{
If (debug){
MsgBox CheckDScan started
}
CoordMode Mouse
If (debug){
;MsgBox About to move mouse to %ScanBtnPos1%, %ScanBtnPos2%
MsgBox About to refresh D-Scan
}
TrayTip, DScan, Copy to Clipboard
BlockInput On
;MouseMove, %ScanBtnPos1%, %ScanBtnPos2%, 10
;Click Down
;Sleep 100
;Click Up Left
;Sleep 100
Send, {Ctrl Down}
Sleep 100
Send, {Shift Down}
Sleep 100
Send, s
Sleep 100
Send, {Shift Up}
Send, {Shift Up}
Sleep 100
Send, {Ctrl Up}
Send, {Ctrl Up}
Sleep 400
If (debug){
MsgBox About to move mouse to DscanPos1, click and copy
}
Clipboard :=
while (Clipboard = ""){
If (debug){
TrayTip, Alert, In while loop
}
MouseMove, %DscanPos1%, %DscanPos2%, 10
Click
Send, {Ctrl Down}
Sleep 100
Send, a
Sleep 100
;Send, {Ctrl Up}
;Sleep 100
;Send, {Ctrl Down}
;Sleep 100
Send, c
Sleep 100
Send, {Ctrl Up}
Sleep 100
Send, {Ctrl Up}
}
BlockInput Off
If (Clipboard = "No Result from Directional Scan" Or Clipboard = "")
{
If (debug){
MsgBox "No Result from Directional Scan"
}
;* 0 Hostiles
intHostilesFound := 0
return
}
Else{
intHostilesFound := 0
If (debug){
MsgBox About to initialize dScanData and parse clipboard into it
}
dScanData := []
Loop, Parse, Clipboard, `n, `r
{
StringSplit, field, A_LoopField, %A_Tab%
dScanData.Push(field1 . field2)
If (debug){
MsgBox Concatenated first two fields = %field1%%field2%
}
}
If (debug){
;MsgBox Open Textpad, then press OK to have all D-Scan data dumped in there
For k, v in dScanData
MsgBox dScanData contents %k%=%v%
}
tempFriendlyShipsSize := arryFriendlyShips.MaxIndex()
If (debug){
MsgBox tempFriendlyShipsSize=%tempFriendlyShipsSize%
}
For iScanned, dScanEntry in dScanData
{
If (iScanned > 1 And dScanEntry = dScanData[iScanned-1]){
Continue
}
timesInDscan := 0
timesInFriendlies := 0
For iScanned2, dScanEntry2 in dScanData
{
If (dScanEntry=dScanEntry2){
timesInDscan := timesInDscan + 1
}
}
For iFriend, strFriendly in arryFriendlyShips
{
If (dScanEntry=strFriendly){
timesInFriendlies := + 1
}
}
If (timesInDscan > timesInFriendlies){
intHostilesFound := intHostilesFound + timesInDscan - timesInFriendlies
}
}
If (debug){
MsgBox intHostilesFound = %intHostilesFound%
MsgBox intHostilesFound=%intHostilesFound% and HostileFoundTime=%HostileFoundTime%
}
If (intHostilesFound > 0){
HostileFoundTime = %A_NowUTC% ;COLON screws it up
If (debug){
MsgBox Set HostileFoundTime to NOW=%HostileFoundTime%
}
}
return
}
return
}
;******************************************
;************************** Friendlies Allowed in Dscan ********************************
;******************************************
GetFriendlies(){
; Get Keys and Values in the Friendlies section (returns as single string delimited by linefeed or 'n)
; Check if friendlyShips found
If (friendlyShips){
If (debug){
MsgBox friendlyShips found = %friendlyShips%
}
; Split multiline string of Keys/Values into single lines
arryFriendlyShips := []
arryFriendlyShipLastUpdate := []
Loop, Parse, friendlyShips, `n, `r
{
; Split single line by = and put the values/ship (field2) into an array
StringSplit, field, A_LoopField, =
arryFriendlyShips.Push(field1)
arryFriendlyShipLastUpdate.Push(field2)
}
If (debug){
For k, v in arryFriendlyShips
MsgBox FriendlyShip %k%=%v%
For k, v in arryFriendlyShipLastUpdate
MsgBox FriendlyShipTime %k%=%v%
}
;Logic for evaluating whether a hostile is found
}
}
;************************* Create or retrieve local settings (Globals) ********************************
GetVariables(){
IfNotExist, %strSharedSettingsPath%
{
If (debug){
MsgBox ERROR! MISSING %strSharedSettingsPath%. Setting it to %strLocalSettingsIni%
}
strSharedSettingsPath := strLocalSettingsIni
}
Else
{
If (debug){
MsgBox , %strSharedSettingsPath% Exists
}
}
;**** Get Local Settings ****
IniRead, strCurrentShip, %strLocalSettingsIni%, GroupVars, ShipNameType
IniRead, intLocalGroupNum, %strLocalSettingsIni%, GroupVars, GroupNum ; If not equal to shared GroupNum, EWO, at POS leave group and rejoin
IniRead, boolIsLeader, %strLocalSettingsIni%, GroupVars, IsLeader
IniRead, TimeSharedLastUpdated, %strLocalSettingsIni%, GroupVars, TimeSharedLastUpdated
;*** Need to change if bot doesn't use probes, as this call causes ERROR if not in INI file
IniRead, strProbeNameType, %strLocalSettingsIni%, GroupVars, ProbeNameType
IniRead, intProbesDeployed, %strLocalSettingsIni%, GroupVars, ProbesDeployed
;**** Get Shared Settings ****
IniRead, intSharedGroupNum, %strSharedSettingsPath%, GroupVars, GroupNum
IniRead, intSharedHostiles, %strSharedSettingsPath%, DScan, Hostiles
IniRead, friendlyShips, %strSharedSettingsPath%, Friendlies
IniRead, sharedHostileFoundTime, %strSharedSettingsPath%, DScan, HostileFoundTime
;**** Get DScan Settings ****
IniRead, ScanBtnPos1, %strLocalSettingsIni%, ScnBtnPos, ScnBtn1
IniRead, ScanBtnPos2, %strLocalSettingsIni%, ScnBtnPos, ScnBtn2
;IniRead, OverTabPos1, %strLocalSettingsIni%, OverTabPos, OverTab1
;IniRead, OverTabPos2, %strLocalSettingsIni%, OverTabPos, OverTab2
IniRead, DscanPos1, %strLocalSettingsIni%, DscanPos, Dscan1
IniRead, DscanPos2, %strLocalSettingsIni%, DscanPos, Dscan2
IniRead, POSPos1, %strLocalSettingsIni%, POSPos, POS1
IniRead, POSPos2, %strLocalSettingsIni%, POSPos, POS2
;MsgBox mouse positions = %ScanBtnPos1%, %ScanBtnPos2%
If(debug){
IniDelete, %strLocalSettingsIni%, debug
MsgBox Cleared DEBUG
IniWrite, %strCurrentShip%, %strLocalSettingsIni%, debug, strCurrentShip
IniWrite, %intLocalGroupNum%, %strLocalSettingsIni%, debug, intLocalGroupNum
IniWrite, %boolIsLeader%, %strLocalSettingsIni%, debug, boolIsLeader
IniWrite, %TimeSharedLastUpdated%, %strLocalSettingsIni%, debug, TimeSharedLastUpdated
IniWrite, %strProbeNameType%, %strLocalSettingsIni%, debug, strProbeNameType
IniWrite, %intProbesDeployed%, %strLocalSettingsIni%, debug, intProbesDeployed
IniWrite, %intSharedGroupNum%, %strLocalSettingsIni%, debug, intSharedGroupNum
IniWrite, %intSharedHostiles%, %strLocalSettingsIni%, debug, intSharedHostiles
IniWrite, %sharedHostileFoundTime%, %strLocalSettingsIni%, debug, sharedHostileFoundTime
IniWrite, %friendlyShips%, %strLocalSettingsIni%, debug, friendlyShips
MsgBox , All variables written to %strLocalSettingsIni%
}
}
;****************** Make sure that DScan is setup in INI file ***************************
CheckSettings()
{
IfNotExist, %strLocalSettingsIni%
{
;************ Get Local Ship Settings ************
If (debug){
MsgBox %strLocalSettingsIni% does NOT Exist!!
}
MsgBox It seems that this is the first time you have run this script. Click OK to begin setup. Whenever you change leaders, ship or ship names you will need to edit or delete the file at %strLocalSettingsIni%
MsgBox, 36, Leader, Will this be the Leader?
IfMsgBox Yes
{
boolIsLeader := true
IniWrite, %boolIsLeader%, %strLocalSettingsIni%, GroupVars, IsLeader
IniWrite, 0, %strLocalSettingsIni%, GroupVars, GroupNum
IniWrite, 0, %strSharedSettingsPath%, GroupVars, GroupNum
}
Else{
IniWrite, false, %strLocalSettingsIni%, GroupVars, IsLeader
}
InputBox, strUserInputShipName, strUserInputShipName, Each bot's ship name needs to be different! Copy and Paste the ship name into here, , , , , , , 2147483,
InputBox, strUserInputShipType, strUserInputShipType, Input the EXACT ship type into here, , , , , , , 2147483,
strCurrentShip := strUserInputShipName . strUserInputShipType
If (debug){
MsgBox strCurrentShip = %strCurrentShip%
}
IniWrite, %strCurrentShip%, %strLocalSettingsIni%, GroupVars, ShipNameType
IniWrite, %A_NowUTC%, %strLocalSettingsIni%, GroupVars, TimeSharedLastUpdated
IniWrite, %A_NowUTC%, %strSharedSettingsPath%, Friendlies, %strCurrentShip%
MsgBox, 36, Probes, Will the ship be using a Probe Launcher?
IfMsgBox Yes
{
If (debug){
MsgBox User selected that a Probe Launcher may be used
}
MsgBox, It is assumed that you will use 8 probes whenever probing or else the DScan synching and Probe Scanning may be unstable.
InputBox, strUserInputProbeName, strUserInputProbeName, Input the EXACT Probe Name into here (usually Scanner Probe), , , , , , , 2147483,
InputBox, strUserInputProbeType, strUserInputProbeType, Input the EXACT Probe Name into here (usually like Sisters Combat Scanner Probe), , , , , , , 2147483,
strProbeNameType := strUserInputProbeName . strUserInputProbeType
If (debug){
MsgBox strProbeNameType = %strProbeNameType%
}
IniWrite, %strProbeNameType%, %strLocalSettingsIni%, GroupVars, ProbeNameType
IniWrite, 0, %strLocalSettingsIni%, GroupVars, ProbesDeployed
}
;Set things so they don't error
IniWrite, 20140104205840, %strLocalSettingsIni%, DScan, HostileFoundTime
IniWrite, 20140104205840, %strSharedSettingsPath%, DScan, HostileFoundTime
IniWrite, 0, %strLocalSettingsIni%, DScan, Hostiles
IniWrite, 0, %strSharedSettingsPath%, DScan, Hostiles
IniWrite, 2, %strLocalSettingsIni%, EPResults, Result
;************ Get DScan Settings ************
MsgBox Time to setup your DScan settings. Please read the instructions before clicking ok to continue. Ensure that your DScan is sorted by Type (Ideally)
;TrayTip, Autopilot Setup, Please move mouse to Scan button and press Altkey
;KeyWait, Alt, D
;CoordMode Mouse
;MouseGetPos, xpos1, ypos1
;ScnBtnPos = %xpos1%, %ypos1%
;TrayTip
;KeyWait, Alt, U
/** TrayTip, Autopilot Setup, Please move mouse to main Overview Tab and press Altkey
KeyWait, Alt, D
CoordMode Mouse
MouseGetPos, xpos2, ypos2
OverTabPos = %xpos2%, %ypos2%
TrayTip
KeyWait, Alt, U
*/
TrayTip, Autopilot Setup, Please Move mouse to d-scan contents display is always visible, and press Altkey
KeyWait, Alt, D
CoordMode Mouse
MouseGetPos, xpos3, ypos3
DscanPos = %xpos3%, %ypos3%
TrayTip
KeyWait, Alt, U
TrayTip, Autopilot Setup, Please Move mouse to the POS bookmark and press Altkey NOT SURE IF THIS WORKS ANY MORE
KeyWait, Alt, D
CoordMode Mouse
MouseGetPos, xpos4, ypos4
POSPos = %xpos4%, %ypos4%
TrayTip
KeyWait, Alt, U
IniWrite, %xpos1%, %strLocalSettingsIni%, ScnBtnPos, ScnBtn1
IniWrite, %ypos1%, %strLocalSettingsIni%, ScnBtnPos, ScnBtn2
; IniWrite, %xpos2%, %strLocalSettingsIni%, OverTabPos, OverTab1
; IniWrite, %ypos2%, %strLocalSettingsIni%, OverTabPos, OverTab2
IniWrite, %xpos3%, %strLocalSettingsIni%, DscanPos, Dscan1
IniWrite, %ypos3%, %strLocalSettingsIni%, DscanPos, Dscan2
IniWrite, %xpos4%, %strLocalSettingsIni%, POSPos, POS1
IniWrite, %ypos4%, %strLocalSettingsIni%, POSPos, POS2
}
}
ExitApp
^+p::pause
Return