Heres the updated code not sure if i've made it worst or better. I've
tried to take your suggestions and implement them. I'll eliminate the
sleep times once I get get these few ideas to work. The cargo check
technicaly works it loops contiously but when the change in pixel
color occurs it doesn't switch to the other if statement. Although if
I restart the macro then it recognizes that the If statement in the
cargocheck is true. I found this out by having the macro send a "t" to
a text area every time the cargocheck was false and then a s when it's
true, but it kept sending "t"s when it was true so now i'm not so
sure. Every time I seem to try to fix it it seems to get worse.


;-==--==--==--==--==--==--==--==--==--==--==--==--==--==-;
;Declarations                                                                   
    ;
;-==--==--==--==--==--==--==--==--==--==--==--==--==--==-;

$repeat = 1
$cargo = pixelgetcolor(1620,895)
$cargonumber = 0
$cargolow = 12000000                    ;range: 12756849 12626291 12561012 
12561525
12561526
$cargohigh = 13500000
$warp = PixelGetColor(875,1010)
$warpnumber = 0
$warplow = 5350000                          ;warp range: 5410498
5476290 5476291
$warphigh = 5550000
$dock = pixelgetcolor(17,714)
$docklow = 10585243
$dockhigh = 10595243
$iceincargo = PixelGetColor(1440,965)
$icecolor = 0
$undock = PixelGetcolor(100,200)                ;not finished
$undocklow = 0                                                  ;not finished
$undockhigh = 0                                                 ;not finished

;-==--==--==--==--==--==--==--==--==--==--==--==--==--==-;
;Main
Code                                                                          ;
;-==--==--==--==--==--==--==--==--==--==--==--==--==--==-;

While $repeat = 1
        Do
                Call("cargocheck")
        Until $cargonumber = 1
        Call("warp2station")
        Sleep(20000)            ;align time
        Do
                Call("warpcheck")
        Until $warpnumber = 1
        Call("dockbug")
        Sleep(5000)
        Call("icecheck")
        Call("undockwarp2bookmark")
        Sleep(15000)
        Do
                Call("warpcheck")
        Until $warpnumber = 1
        Call("setup")

WEnd

;-==--==--==--==--==--==--==--==--==--==--==--==--==--==-;
;Functions                                                                      
;
;-==--==--==--==--==--==--==--==--==--==--==--==--==--==-;

Func cargocheck()
If $cargo > $cargolow and $cargo < $cargohigh Then
        $cargonumber = 1
ElseIf $cargo < $cargolow or $cargo > $cargohigh Then
        $cargonumber = 0
Else
        $cargonumber = 0
EndIf
EndFunc

Func warp2station()
MouseClick("right",800,50,1,1)                                  ;Right click 
for menu
sleep(1000)
mousemove(900,140,1)                                                    
;Highlight Station
sleep(500)
mousemove(1200,140,1)                                                   
;Highlight first station on list
sleep(500)
mousemove(1360,145,1)                                                   
;Highlight warp to within 0m
sleep(500)
mouseclick("left",1360,195,1,1)                                 ;click dock
EndFunc

Func warpcheck()
If $warp < $warplow Or $warp > $warphigh Then
        $warpnumber = 1
Else
        $warpnumber = 0
EndIf
EndFunc

Func dockbug()
If $dock > $dockhigh or $dock < $docklow then   ;if docking pixel is
not right then sleep and go through menu
        Sleep(3000)
        ;MsgBox(0,"Dock Pixel Color", $dock)
        ;mouseclick("right",800,50,1,1)                         ;right click 
for menu(incase for
dock bug)
        ;sleep(500)
        ;mousemove(900,140,1)                                           
;Highlight Station(incase for dock bug)
        ;sleep(500)
        ;mousemove(1200,140,1)                                          
;Highlight first station on list(incase
for dock bug)
        ;sleep(500)
        ;mousemove(1360,145,1)                                          
;Highlight warp to within 0m(incase for
dock bug)
        ;sleep(500)
        ;mouseclick("left",1360,175,1,1)                                ;click 
dock(incase for dock bug)
ElseIf $dock <= $dockhigh And $dock >= $docklow Then                            
        ;If the
docking pixel is correct then
EndIf
EndFunc

Func icecheck()
If $iceincargo = $icecolor Then
        MouseClickDrag("left",1460,960,1160,970,10)             ;Drag from 
Cargo to
Hangar
ElseIf $iceincargo > $icecolor Then
EndIf
EndFunc

Func undockchecker()    ;not finished
;detect black screen while undocking
EndFunc

Func undockwarp2bookmark()
MouseClick("left",18,1021,1,1)                                  ;Click Undock
Sleep(30000)                                                                    
;Wait to Finish Undock-will be replaced with
function undockchecker()
MouseClick("right",800,50,1,1)                                  ;Right click 
for menu
sleep(1000)
mousemove(900,176,1)                                                    
;highlight first bookmark
sleep(500)
mouseclick("left",1100,176,1,1)                                 ;click warp to 
bookmark at 0m
EndFunc

Func setup()
mouseclick("left",1450,172,1,1)                                 ;sort overview 
by farthest
away(overview bug)
sleep(1000)
mouseclick("left",1450,172,1,1)                                 ;sort overview 
by closest(overview
bug)
sleep(1000)
mouseclick("left",1500,190,1,1)                                 ;select nearest 
ice rock
sleep(1000)
mouseclick("left",1540,85,1,1)                                  ;lock target
sleep(1000)
mouseclick("left",1409,84,1,1)                                  ;approach 
rock(incase for bumping
sleep(1000)
send("{F1}")                                                                    
;activate #1 mining laser
sleep(500)
send("{F2}")                                                                    
;activate #2 mining laser
sleep(500)
send("{ALTDOWN}")
sleep(1000)
send("{F1}")                                                                    
;activate shield booster
sleep(1000)
send("{ALTUP}")
EndFunc

Reply via email to