Jump to content

Multicolor clicker


Pharon
 Share

Recommended Posts

HotKeySet("=", "MyExit")
HotKeySet("[", "MyStop")
HotKeySet("-", "MyStart")

Do
Until 0

Func MyStart()
$s = 1
Do
If $s = 1 Then
$coord = PixelSearch( 359, 378, 748, 379, 0x219988 )
If @error Then
$s = $s + 1
Else
MouseMove ( $coord[0], $coord[1] , 0 )
EndIf

If $s = 2 Then
$coord = PixelSearch( 359, 378, 748, 379, 0x020380 )
If @error Then
$s = $s + 1
Else
MouseMove ( $coord[0], $coord[1] , 0 )
EndIf

If $s = 3 Then
$coord = PixelSearch( 359, 378, 748, 379, 0x818507 )
If @error Then
$s = $s + 1
Else
MouseMove ( $coord[0], $coord[1] , 0 )
EndIf

If $s = 4 Then
$coord = PixelSearch( 359, 378, 748, 379, 0x9E9E9E )
If @error Then
$s = 1
Else
MouseMove ( $coord[0], $coord[1] , 0 )
EndIf
Until $s = 99
EndFunc

Func MyStop()
   $s = 99 
EndFunc

Func MyExit()
   Exit 
EndFunc

Well, I tried to make it detect a color then put the mouse to it, but for some reason every time I run it I get a error saying that "Until $s = 99" has no matching Do statement, but there is one right at the begining.

I know this is in my color post, but I started to think that I was getting off topic in my own thread so I started a new one. Plus with it being the first post it might get me some answers...

Link to comment
Share on other sites

  • Developers

this is what tidy says... does that help ?:

HotKeySet("=", "MyExit")
HotKeySet("[", "MyStop")
HotKeySet("-", "MyStart")
Do
Until 0
Func MyStart()
   $s = 1
   Do
      If $s = 1 Then
         $coord = PixelSearch(359, 378, 748, 379, 0x219988)
         If @error Then
            $s = $s + 1
         Else
            MouseMove($coord[0], $coord[1], 0)
         EndIf
         If $s = 2 Then
            $coord = PixelSearch(359, 378, 748, 379, 0x020380)
            If @error Then
               $s = $s + 1
            Else
               MouseMove($coord[0], $coord[1], 0)
            EndIf
            If $s = 3 Then
               $coord = PixelSearch(359, 378, 748, 379, 0x818507)
               If @error Then
                  $s = $s + 1
               Else
                  MouseMove($coord[0], $coord[1], 0)
               EndIf
               If $s = 4 Then
                  $coord = PixelSearch(359, 378, 748, 379, 0x9E9E9E)
                  If @error Then
                     $s = 1
                  Else
                     MouseMove($coord[0], $coord[1], 0)
                  EndIf
;### Tidy Error: Level error -> Until is closing previous If
               Until $s = 99
;### Tidy Error: Level error -> EndFunc is closing previous If
            EndFunc  ;==>MyStart
;### Tidy Error: Level error -> "If" Not closed before Func statement.
;### Tidy Error: Level error -> "Func" cannot be inside any IF/Do/While/For/Case/Func statement.
            Func MyStop()
               $s = 99
            EndFunc  ;==>MyStop
;### Tidy Error: Level error -> "If" Not closed before Func statement.
;### Tidy Error: Level error -> "Func" cannot be inside any IF/Do/While/For/Case/Func statement.
            Func MyExit()
               Exit
            EndFunc  ;==>MyExit

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

What a mess. You should more careful closing While/Wend, If/EndIf, ect.

I advice you writing, when you create a new loop or if, also the closing tag. So you'll have a more sorted idea.

So, you need an If? Write

If
  ;Continue here
EndIf

a While?

While
  ;Continue here
Wend

Secondly a

Do
Until 0

is not advised since your script will maximize your CPU for nothing. Use a pause.

Do
Sleep(1000)
Until 0

Finally indent as much you can. It becomes lots easier to detect loops/if errors.

(jdeb went straight in that idea!)

Scite for Autoit have Tidy, a great Jdeb's program, that will make that for you.

Code, code, code... You need think a little? Press CTRL+9, while you think the computer will tidy the code.

Edited by ezzetabi
Link to comment
Share on other sites

Do
     If $s = 1 Then
        $coord = PixelSearch(359, 378, 748, 379, 0x219988)
        If @error Then
           $s = $s + 1
        Else
           MouseMove($coord[0], $coord[1], 0)
        EndIf

So instead of that I want to move the EndIf to before else?

Do
     If $s = 1 Then
        $coord = PixelSearch(359, 378, 748, 379, 0x219988)
        If @error Then
           $s = $s + 1
        EndIf
        Else
           MouseMove($coord[0], $coord[1], 0)

like that?

Link to comment
Share on other sites

  • Developers

Do
      If $s = 1 Then
         $coord = PixelSearch(359, 378, 748, 379, 0x219988)
         If @error Then
            $s = $s + 1
         Else
            MouseMove($coord[0], $coord[1], 0)
         EndIf
      EndIf
      If $s = 2 Then
...... etc

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Anyway, I guess you meant

HotKeySet("=", "MyExit")
HotKeySet("[", "MyStop")
HotKeySet("-", "MyStart")

Do
   Sleep(1000)
Until 0

Func MyStart()
   $s = 1
   Do
      If $s = 1 Then
         $coord = PixelSearch(359, 378, 748, 379, 0x219988)
         If @error Then
            $s = $s + 1
         Else
            MouseMove($coord[0], $coord[1], 0)
         EndIf
      ElseIf $s = 2 Then
         $coord = PixelSearch(359, 378, 748, 379, 0x020380)
         If @error Then
            $s = $s + 1
         Else
            MouseMove($coord[0], $coord[1], 0)
         EndIf
      ElseIf $s = 3 Then
         $coord = PixelSearch(359, 378, 748, 379, 0x818507)
         If @error Then
            $s = $s + 1
         Else
            MouseMove($coord[0], $coord[1], 0)
         EndIf
         
      ElseIf $s = 4 Then
         $coord = PixelSearch(359, 378, 748, 379, 0x9E9E9E)
         If @error Then
            $s = 1
         Else
            MouseMove($coord[0], $coord[1], 0)
         EndIf
      EndIf
   Until $s = 99
EndFunc  ;==>MyStart


Func MyStop ()
   $s = 99
EndFunc  ;==>MyStop 

Func MyExit ()
   Exit
EndFunc  ;==>MyExit
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...