Jump to content

Whats wrong this codes


cerix
 Share

Recommended Posts

HotKeySet("(Home)","_Start")

HotKeySet("(insert)","_Stop")

While 1

$Variable = PixelSearch(240,202,580,550,0xCE2E16)

If IsArray($Variable) = True Then

MouseMove($Variable [0], $Variable [1],1)

MouseClick("right")

EndIf

WEnd

While 2

$Variable = PixelSearch(190,190,750,600,0xE5EAEB)

If IsArray($Variable) = True Then

MouseMove($Variable [0], $Variable [1],1)

MouseClick("left")

EndIf

WEnd

While 3

$Variable = PixelSearch(190,190,750,600,0xDCF070)

If IsArray($Variable) = True Then

MouseMove($Variable [0], $Variable [1],1)

MouseClick("left")

EndIf

WEnd

Func _Exit()

Exit

EndFunc

;)

Link to comment
Share on other sites

A: Theres 3 While loops. Use 1.

B: Try tossing some error processing in there somewhere to locate WHERE the error is...

C: I assume the program closes while appearing to do nothing? It can't find the specified pixels. --- Nvm... didn't notice the forever loops.

D: I second-assume your pressing "Home" to start the script... And your hotkeys aren't bound to anything.

Try This...

HotKeySet("{Home}","_Start") HotKeySet("{insert}","_Stop")  While 1     Sleep(500) WEnd  Func _Start()  $Variable1 = PixelSearch(240,202,580,550,0xCE2E16)  If @Error Then      MsgBox(0, "Error", "$Variable1 couldn't find the color.")   Else        If IsArray($Variable1) = True Then          MouseMove($Variable1[0], $Variable1[1],1)           MouseClick("right")         Else            MsgBox(0, "Error", "$Variable1 isn't an array.")        EndIf   EndIf   $Variable2 = PixelSearch(190,190,750,600,0xE5EAEB)  If @Error Then      MsgBox(0, "Error", "$Variable2 couldn't find the color.")   Else        If IsArray($Variable2) = True Then          MouseMove($Variable2[0], $Variable2[1],1)           MouseClick("left")      Else            MsgBox(0, "Error", "$Variable2 isn't an array.")        EndIf   EndIf   $Variable3 = PixelSearch(190,190,750,600,0xDCF070)  If @Error Then      MsgBox(0, "Error", "$Variable1 couldn't find the color.")   Else        If IsArray($Variable3) = True Then          MouseMove($Variable3[0], $Variable3[1],1)           MouseClick("left")      Else            MsgBox(0, "Error", "$Variable3 isn't an array.")        EndIf   EndIf EndFunc  Func _Stop()     Exit EndFunc
Edited by Dreu
Link to comment
Share on other sites

HotKeySet("(Home)","_Start")

HotKeySet("(insert)","_Stop")

While 1

$Variable = PixelSearch(240,202,580,550,0xCE2E16)

If IsArray($Variable) = True Then

MouseMove($Variable [0], $Variable [1],1)

MouseClick("right")

EndIf

WEnd

only use this

Edited by chorao157
Link to comment
Share on other sites

HotKeySet("(Home)","_Start")

HotKeySet("(insert)","_Stop")

While 1

$Variable = PixelSearch(240,202,580,550,0xCE2E16)

If IsArray($Variable) = True Then

MouseMove($Variable [0], $Variable [1],1)

MouseClick("right")

EndIf

WEnd

only use this

i know but i want so

right click to 0xCE2E16 then open another symbol

another symbol colors 0xE5EAEB

left clixkt to 0xE5EAEB then open the an another symbol

lastly symbol color code 0xDCF070

i want to follow each other

Link to comment
Share on other sites

@OP If this is the same program as the one in your other topic I strongly suggest you follow the non-pixelsearch approach.

Make the best of the help you're getting in that topic as it will lead to a much more reliable script.

edit:

but if you insist on the pixelsearch approach:

Do
    $aPos = PixelSearch(240,202,580,550,0xCE2E16) ;repeat pixelsearch 
Until IsArray($aPos) ;until it returns an array (no infinite loop this way)
MouseClick("right",$aPos[0],$aPos[1]) ;then click that pixel.

Do
    $aPos = PixelSearch(190,190,750,600,0xE5EAEB)
Until IsArray($aPos)
MouseClick("left",$aPos[0],$aPos[1])

Do
    $aPos = PixelSearch(190,190,750,600,0xDCF070)
Until IsArray($aPos)
MouseClick("left",$aPos[0],$aPos[1])
Edited by Tvern
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...