Funny note: My AHK is making the bot even more efficient because, without scanner, the drones will sometimes drain a roid that didn't start at the expected volume. In this case my AHK will see that the drones emptied it, and will turn off the mining laser saving me 2 minutes in some cases.
Okay, I was having trouble understanding what to test, but now I now see that I wasn't understanding. Then I found this quote:
Nondeth wrote:
It seems like I've encountered a condition which will cause the bot to ELO when mining to a jettisoned container. If the bot does a select all just as a laser finishes a cycle, it will lose the selection on the stack which just updated. It will then try to jettison, and will either have a little to jettison or nothing at all, at which point it appears to just panic as it watches for the cargo space to drop - which never happens because of the selection failure.
Even if I could catch it and pause at that exact time... It still wouldn't change your logic. So are you looking to see if the m3 went down by the exact amount, significant amount, or what?
Because you can't do anything about that timing, there are a number of items that could be checked:
- Ore Hold m3 Before
- New cannister created
- Ore Hold m3 After
- New cannister m3
I tend to heavily factor/split functions so that they can be reused more often. So here's what I'd try to do (leaving out the non-essential stuff):
JettisonCargo - Leave as a function that calls other functions and controls the overall logic flow (as it seems to do now).
Warning: Spoiler!;(Please forgive me, I'm not trying to be annoying. I'm just making a suggestion. Also, this helped me a lot in figuring out how I want my continued development to be structured.)
JettisonCargo(stopTime){
boolJettisonCargo := False
If(WindowMgr.OreHold.OpenWIndow() = False){
Return 0
}
If(WindowMgr.Overview.CheckPreset(4) = False){
Return 0
}
aryCansStart := []
aryCansStart := WindowMgr.Overview.ScanOverview() ; Holds arrays with fields for each can in them
boolJetCanOpen := False
Warning: Spoiler! If(aryCansStart.MaxIndex() != ""){
For lineNum, tmpFields in aryCansStart
{
canDistance := tmpFields[2] ; 2 = whatever field is distance
; get other stuff for validation out of tmpFields
If(canDistance < 2000 And {other validation}){
If(WindowMgr.Overview.SelectLine(lineNum) And WindowMgr.Overview.OpenLine(lineNum) And WindowMgr.JetCan.FindWindow()){
boolJetCanOpen := True
}
}
}
}
If(boolJetCanOpen){
startingJetCan := WindowMgr.JetCan.Getm3()
startingCargo := WindowMgr.OreHold.Getm3() ; Right before Select all, as you know
If(WindowMgr.OreHold.SelectAll() = False){ ; False would mean it didn't find the menu item to click
WindowMgr.JetCan.Close()
boolJettisonCargo := False ; Unnecessary here, but not a bad idea
}
Else{
WindowMgr.MoveItem(WindowMgr.OreHold , WindowMgr.JetCan)
endingCargo := WindowMgr.OreHold.Getm3()
endingJetCan := WindowMgr.JetCan.Getm3()
;... SORRY I got a little carried away! Surely you know how it is when you need to figure out the basics, but forget to get back to the original task for a bit! Gonna skip to the part I meant to write
}
}
startingCargo := WindowMgr.OreHold.Getm3()
If(boolJettisonCargo = False And WindowMgr.MinutesSinceLastJettison > 3 And startingCargo > MaxCargoPercent)){
startingCargo := WindowMgr.OreHold.Getm3() ; Right before Select all, as you know
If(WindowMgr.OreHold.SelectAll() = False Or WindowMgr.OreHold.Jettison() = False){ ; False would mean it didn't find the menu item to click
Return 0
}
Else{
endingCargo := WindowMgr.OreHold.Getm3()
aryCansEnd := []
aryCansEnd := WindowMgr.Overview.ScanOverview() ; Holds arrays with fields for each can in them
; Find the newCanLine in aryCansEnd
WindowMgr.Overview.NameCan(newCanLine)
If(endingCargo > MaxCargoPercent){
If(stopTime < currentTime){
Return 2
}
Return WindowMgr.JettisonCargo(stopTime) ; This way it doesn't matter if extra ore arrives at any time
}
Return 4
}
}
}