Jump to content
Sign in to follow this  
cerix

Whats wrong this codes

Recommended Posts

cerix

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

;)

Share this post


Link to post
Share on other sites
enaiman

;) alot of things are wrong

- there is no _Start function

- there is no _Stop function

- there is absolutely no way out of your all 3 While loops

Guess that would be "alot".


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
Dreu

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

Share this post


Link to post
Share on other sites
cerix

;) alot of things are wrong

- there is no _Start function

- there is no _Stop function

- there is absolutely no way out of your all 3 While loops

Guess that would be "alot".

Please help me write to true code

Share this post


Link to post
Share on other sites
Dreu

It is pasting it as one big line -.-...

I wrote it, you get to space it out =).

Share this post


Link to post
Share on other sites
chorao157

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

Share this post


Link to post
Share on other sites
cerix

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

Share this post


Link to post
Share on other sites
Tvern

@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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.