Jump to content

Need help with function


Recommended Posts

I need help with this function. What I want it to do is check if the pixel color at 171,148 is white,if it is then it will click 585,234. If the pixel is not white I want it to click on 260,276 until the pixel color at 147,230 is white. I also need it to loop over and over until the pixel color at 147,230 is white. Thanks for your help.

func attack()
mousemove(260,276)
while 1
do
    if pixelgetcolor(171,148) = 0xFFFFFF Then 
        mouseclick("left",585,234,1,$randomdelay)
else
        mouseclick("left",260,276,1,$randomdelay)
 until PixelGetColor(147,230) = 0xFFFFFF
EndIf
wend
endfunc
Edited by Insaynity
Link to comment
Share on other sites

I am still learning myself but try this

$randomdelay = Random(100, 1000)

Func attack()
    Do
        $atk = PixelGetColor(171, 148, 2)
        If $atk = 0xFFFFFF Then
            MouseClick("left", 585, 234, 1, $randomdelay)
            If $atk <> 0xFFFFFF Then
                MouseClick("left", 260, 276, 1, $randomdelay)
            EndIf
        EndIf
    Until $atk = 0xFFFFFF
EndFunc  ;==>attack
Link to comment
Share on other sites

I need help with this function. What I want it to do is check if the pixel color at 171,148 is white,if it is then it will click 585,234. If the pixel is not white I want it to click on 260,276 until the pixel color at 147,230 is white. I also need it to loop over and over until the pixel color at 147,230 is white. Thanks for your help.

func attack()
mousemove(260,276)
while 1
do
    if pixelgetcolor(171,148) = 0xFFFFFF Then 
        mouseclick("left",585,234,1,$randomdelay)
else
        mouseclick("left",260,276,1,$randomdelay)
 until PixelGetColor(147,230) = 0xFFFFFF
EndIf
wend
endfunc
Edited it a little but got it to work exactly how I wanted. This also helped me with another bit of code I had. Thank you.
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...