Jump to content

need help with clor-clicker


z00p
 Share

Recommended Posts

Global $window = "myGameWindow_iknow" 

While WinExists($window)


$SearchPixel = PixelSearch(1, 1, 1300, 1000, 0x581D19)
If @success Then
MouseClick("left", $SearchPixel[0], $SearchPixel[1], 2, 0)
EndIf
Wend

why dont this script start....

whats wrong...

Link to comment
Share on other sites

  • Developers

why dont this script start....

whats wrong...

Are you sure it doesn't start? could it be the WinExist() fails and the script Ends right after it started ?

By the way: @success is not a valid macro.

Try:

Global $window = "myGameWindow_iknow"

While WinExists($window)
    $SearchPixel = PixelSearch(1, 1, 1300, 1000, 0x581D19)
    If Not @error Then
        MouseClick("left", $SearchPixel[0], $SearchPixel[1], 2, 0)
    EndIf
WEnd
MsgBox(0,"Program ended","Program ended")
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

if I only could get it to on in a never ending loop...

Try this:

Global $window = "myGameWindow_iknow"

While 1
 If WinExists($window) = 1 Then
  $SearchPixel = PixelSearch(1, 1, 1300, 1000, 0x581D19)
  If Not @error Then
   MouseClick("left", $SearchPixel[0], $SearchPixel[1], 2, 0)
  EndIf
   MsgBox(0,"Program ended","Program ended")
 Else
  ExitLoop
 EndIf
WEnd
SciTE - much better than notepad. ; ]
Link to comment
Share on other sites

  • Moderators

This one only works if the window exists, then shows the msgbox that the window didn't exist and ends.

Global $window = "myGameWindow_iknow"

While WinExists($window)
    $SearchPixel = PixelSearch(1, 1, 1300, 1000, 0x581D19)
    If Not @error Then
        MouseClick("left", $SearchPixel[0], $SearchPixel[1], 2, 0)
    EndIf
WEnd
MsgBox(0,"Program ended","Program ended")

This one is exactly the same except more code, and it doesn't end neccesarily where the msgbox is, because it will loop again one more timme if the window exists.

Global $window = "myGameWindow_iknow" 

While 1
If WinExists($window) = 1 Then
  $SearchPixel = PixelSearch(1, 1, 1300, 1000, 0x581D19)
  If Not @error Then
   MouseClick("left", $SearchPixel[0], $SearchPixel[1], 2, 0)
  EndIf
   MsgBox(0,"Program ended","Program ended")
Else
  ExitLoop
EndIf
WEnd

Edit: Here try this, a little bit of everyone here..

Opt("WinTitleMatchMode", 4)
Opt("PixelCoordMode", 0); make sure you change the 0 to 1 if you're using screen coords or 2 for client coords
Opt("MouseCoordMode", 0); make sure you change the 0 to 1 if you're using screen coords or 2 for client coords
Global $window = "myGameWindow_iknow"; make sure you actually change this to the title of the game window!!

WinWait($window)
While WinExists($window)
    WinWaitActive($window)
    $SearchPixel = PixelSearch(1, 1, 1300, 1000, 0x581D19)
    If Not @error And IsArray($SearchPixel) Then
        MouseClick("left", $SearchPixel[0], $SearchPixel[1], 2, 0)
    EndIf
WEnd
MsgBox(0,"Program ended","Program ended")
Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The last code that you wrote ronsrules, was the only script that started...

Opt("WinTitleMatchMode", 4)
Opt("PixelCoordMode", 1); make sure you change the 0 to 1 if you're using screen coords or 2 for client coords
Opt("MouseCoordMode", 1); make sure you change the 0 to 1 if you're using screen coords or 2 for client coords
Global $window = "ShlmgVw:CPreviewWnd"; make sure you actually change this to the title of the game window!!

WinWait($window)
While WinExists($window)
    WinWaitActive($window)
    $SearchPixel = PixelSearch(1, 1, 1300, 1000, 0xFF0000)
    If Not @error And IsArray($SearchPixel) Then
        MouseClick("left", $SearchPixel[0], $SearchPixel[1], 2, 0)
    EndIf
WEnd
MsgBox(0,"Program ended","Program ended")

This is the exact code that Im useing.

"ShlmgVw:CPreviewWnd" , I made a test.jpg with just a sircle of the color FF0000, to see if I could get it to work outside my game first.

When I use "PixelSearch", what if there are more than 1 pixel that is FF0000, does the scrit stop/crash?

maybe thats been my problem...

what is the differense betweeen: screen coords and client coords???

Edited by z00p
Link to comment
Share on other sites

  • Moderators

The last code that you wrote ronsrules, was the only script that started...

what is the differense betweeen: screen coords and client coords???

Well the last one was the one that I "wrote"... the others were comparisons of previous posts.

Not an expert, but from what I've seen:

0. Window Coords: Uses the entire applications GUI for its coords / will change with different OS(s) or Theme Settings.

1. Screen Coords: Uses your desktop height and width for its coords.

2. Client Coords: Doesn't use the Windows based borders/titlebars/etc... in it's coords.

Edit: The color red: 0xFF0000 doesn't leave much room for error... when doing a script like this, I would suggest find something "unique" to set it apart to make sure your not crashing. Maybe using the variable for the pixel search and going down one or two and left one or two to find the most unique attributes that this area has that your looking for would help.

Good Luck!

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Well the last one was the one that I "wrote"... the others were comparisons of previous posts.

Not an expert, but from what I've seen:

0. Window Coords: Uses the entire applications GUI for its coords / will change with different OS(s) or Theme Settings.

1. Screen Coords: Uses your desktop height and width for its coords.

2. Client Coords: Doesn't use the Windows based borders/titlebars/etc... in it's coords.

Edit: The color red: 0xFF0000 doesn't leave much room for error... when doing a script like this, I would suggest find something "unique" to set it apart to make sure your not crashing. Maybe using the variable for the pixel search and going down one or two and left one or two to find the most unique attributes that this area has that your looking for would help.

Good Luck!

I know "0xFF0000" doesnt leave room for error, but when I made a test.jpg with only color 0xFF0000, you should think the script would fine atleast one pixel with 0xFF0000.

but it dont, it does atleast not move the mouse over to the picture...

so, before getting this to work in my game, I need to get it work in windows...

but no B)

Edited by z00p
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...