1st
I remember why I had to do the If Elseif Endif. It's because the Else
can't handle more than 1 statement so I had to use the Elseif to make
sure the $cargo is within $cargohigh and $cargolow.

On Nov 6, 5:11 pm, Gotrek65 <[EMAIL PROTECTED]> wrote:
> 1st
> good point on the if elseif, should be a else since it only has 2
> options.
> 2nd
> why will it never be executed? oh I see what I messed up there the and
> or statements are swapped, the needs to be in the if statement and the
> or needs to be in the else statement
> 3rd
> Why is sleep bad? I've eliminated all but one of the large variable
> sleeps. Yes granted the sleep times shouldn't need to be put into the
> loops.
> 4th
> I think I got what you ment by constants, your absolutely right the
> constants(like my ranges and non changing numbers) should be up in the
> declarations so they can be called like the others
>
> On Nov 6, 12:44 pm, Glenn <[EMAIL PROTECTED]> wrote:
>
> > First of all, in cargocheck(), why do you have the condition on the else?
> > That condition is the exact opposite of the if statement.  There's no need
> > to put an if condition on the else because that's all it'll be when it gets
> > there.
>
> > Secondly, in warpcheck(), the else condition will never evaluate to TRUE and
> > therefore the code in it will never get executed.
> > Thirdly, why sleep()?  BAD, BAD, BAD!!!  You should not use sleep() in GUI
> > programming.  If you need to wait for an event, then put in an event handler
> > that will capture the event as it finishes.
>
> > Fourthly, learn constants.  It makes your code hard to read with the
> > numerics inline.  The constants will make the code more understandable if
> > you give them names that are meaningful.
>
> > From the looks of it, you're trying to do procedural programming in an event
> > driven environment.  Leave the procedural methods behind!!
>
> > ...Glenn
>
> > On Thu, Nov 6, 2008 at 1:35 PM, Gotrek65 <[EMAIL PROTECTED]> wrote:
>
> > > This is a long post because i've changed the program quite a bit it's
> > > almost finish and im including the 132 lines of code. It seems though
> > > that the macro is ignoring any if then statements within the
> > > functions.
>
> > > I'm pretty damn sure that If then Elseif statements were a form of
> > > loops. I could throw in a few Do Untils into it but would that really
> > > fix the issue or make it just more messy?
>
> > > ;-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
> > > ==--==--==--==-;
> > > ;Color
> > > Finder
> > >    ;
> > > ;-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
> > > ==--==--==--==-;
>
> > > ;If $repeat = 1 then                                            ;comment
> > > all and then uncomment this if
> > > statement to find color range of your pixel
> > > ;$warp = pixelgetcolor(875,1010);
> > > ;MsgBox(0,"Dock Decimal",$warp)                         ;get several of
> > > these and record
> > > them to obtain a range of color variations
> > > ;endif
>
> > > ;-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
> > > ==--==--==--==-;
> > > ;Declarations
> > >         ;
> > > ;-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
> > > ==--==--==--==-;
>
> > > $repeat = 1
> > > $cargo = pixelgetcolor(1620,895)
> > > $warp = PixelGetColor(875,1010)
> > > $dock = pixelgetcolor(17,714)
> > > $iceincargo = PixelGetColor(1440,965)
> > > $undock = PixelGetcolor(100,200)                ;not finished
>
> > > ;-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
> > > ==--==--==--==-;
> > > ;Main
> > > Code
> > >    ;
> > > ;-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
> > > ==--==--==--==-;
>
> > > While $repeat = 1
> > >        Call("cargocheck")
> > >        Call("warp2station")
> > >        Sleep(20000)
> > >            ;align time
> > >        Call("warpcheck")
> > >        Call("dockbug")
> > >        Sleep(5000)
> > >        Call("icecheck")
> > >        Call("undockwarp2bookmark")
> > >        Sleep(15000)
> > >        Call("warpcheck")
> > >        Call("setup")
>
> > > WEnd
>
> > > ;-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
> > > ==--==--==--==-;
> > > ;Functions
> > >          ;
> > > ;-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
> > > ==--==--==--==-;
>
> > > Func cargocheck()
> > > If $cargo <= 12000000 Or $cargo >= 13500000 then
> > >                      ;13019237
> > > 12953445 12756593 1295002 12492637 12426843 12229466 12229465 12163672
> > > 12163929 12097879 12097623 12032086
> > >        sleep(2000)
> > > ElseIf $cargo >= 12000000 and $cargo <= 13500000 Then
> > >        MsgBox(0,"Cargo?",$cargo)
> > > 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 <= 5550000 Or $warp >= 5350000 Then            ;warp: 5410498
> > > 5476290
> > > 5476291
> > >        Sleep(2000)
> > > ElseIf $warp <= 535000 And $warp >= 5550000 Then
> > >        Sleep(10000)
> > > EndIf
> > > EndFunc
>
> > > Func dockbug()
> > > If $dock > 10595243 or $dock < 10585243 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 = 10595243 Then                                    ;If the
> > > docking pixel is correct then
> > > EndIf
> > > EndFunc
>
> > > Func icecheck()
> > > If $iceincargo = 0 Then
> > >        MouseClickDrag("left",1460,960,1160,970,10)             ;Drag from
> > > Cargo to
> > > Hangar
> > >        sleep(2000)
> > >        ContinueCase
> > > ElseIf $iceincargo > 0 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(depends on lag/busy
> > > station)
> > > 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