Jump to content

Recommended Posts

Posted

Well for one, what is the point of having If $var=1 then twice?

then $var = 0 so after that all the program will do is update $coord

also change your while to just while 1

Giggity

Posted (edited)

I would try the following code...

$var = 1

While 1
    $pos = MouseGetPos()
    $coord = PixelSearch($pos[0], $pos[1], $pos[0], $pos[1], 0x2CFD39)
    If Not @error Then
        If $var = 1 Then
            Send("{a}")
            Sleep(20)
            
            If $var = 1 Then
                MouseClick('left')
                Sleep(50)
                $var = 0
            EndIf        
        EndIf
    Else
        ExitLoop
    EndIf
WEnd

Edit: You may not want the else statement there, but I figure at some point you'll want out of the loop so I put it in there.

I hope it helps,

Jarvis

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Posted

I would try the following code...

$var = 1

While 1
    $pos = MouseGetPos()
    $coord = PixelSearch($pos[0], $pos[1], $pos[0], $pos[1], 0x2CFD39)
    If Not @error Then
        If $var = 1 Then
            Send("{a}")
            Sleep(20)
            
            If $var = 1 Then
                MouseClick('left')
                Sleep(50)
                $var = 0
            EndIf        
        EndIf
    Else
        ExitLoop
    EndIf
WEnd

Edit: You may not want the else statement there, but I figure at some point you'll want out of the loop so I put it in there.

I hope it helps,

Jarvis

Still what is the point of $var = 1 then being there twice? nothing between the first statement and second can change the variable. and it still wont do anything after the first through.

Giggity

Posted

The reason why it doesn't do both is you're not allowing for the speed of your system. You would need a larger sleep between them. It's just large enough when you add another evaluation in there before performing the remaining options.

If you want it to sleep at the end add that right before the WEnd.

I hope it helps,

Jarvis

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...