Jump to content

Pixel Help


Recommended Posts

Okay well, i have no clue how to search for a pixel in a square and when it see's it click somewhere else... Like the Pixel Search is triggered by Ctrl+z and stopped By Ctrl+x

I got the square it needs to be in.

Top Left= 470, 291
Bottom Left= 473, 326
Top Right= 515, 289
Bottom Right= 515, 324

and the color i need it to search for is this.

Pixel Color,  Hex: 0x585858   Dec: 5789784

So like its always running But The Ctrl+Z Starts It And The Ctrl+x Pauses it.

But when it see's the the color, i want it to click at, but it needs to be instant. Thats very important.

439, 527

I Hope you understand what i mean...

Thanks,

Zap

Edited by zappiezap
Link to comment
Share on other sites

so something like

AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("PixelCoordMode", 0)

While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 0x585858, 5)
   If  Then
   MouseClick ( "Left" ,439 , 527 , 1 , 0 )
   EndIf
Wend

But what is the Top Left, Top Right, And Bottom Left, and Bottom Right Out of:

Top Left= 470, 291
Bottom Left= 473, 326
Top Right= 515, 289
Bottom Right= 515, 324
Edited by zappiezap
Link to comment
Share on other sites

so something like

AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("PixelCoordMode", 0)

While 1
   $Coord = PixelSearch ( 0, 0, 500, 500, 0x585858, 5)
   If  Then
   MouseClick ( "Left" ,439 , 527 , 1 , 0 )
   EndIf
Wend

But what is the Top Left, Top Right, And Bottom Left, and Bottom Right Out of:

Top Left= 470, 291
Bottom Left= 473, 326
Top Right= 515, 289
Bottom Right= 515, 324

<{POST_SNAPBACK}>

I'm not sure. Try

$Coord = PixelSearch (470, 291, 515, 324, 0x585858, 5)

assumes your coordinates are in x,y format

and assumes that I'm reading the help file correctly

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Okay, well i got it working, so of

Becuase it finds the pixel color but, it always trys clicking at:

588, 629  X,Y

when its supposed to be going to:

439, 527  X,Y

But i need the hoykey help bad.. i gtg soon and i wanted this done >.<

Here's what i have so far, how would i hotkey this into where ctrl+z starts it and Ctrl+x pauses it.. But i still want it to stay in the backround. SO i can use it over and over again

AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("PixelCoordMode", 0)

While 1
   $Coord = PixelSearch (470, 291, 515, 324, 0x585858, 5)
   If Not @error Then
   MouseClick ( "Left" , 439, 527 , 1 , 0 )
   EndIf
Wend
Edited by zappiezap
Link to comment
Share on other sites

Read HotKeySet() in the help file. Don't say you don't have time as it only takes about 2 minutes of your life, and there is already a pause example in the HotKeySet() help file example.

Edited by Burrup

qq

Link to comment
Share on other sites

Might they be off becuase i am in a game?

I need it to click at

439, 527

when it see's the color, isnt what i have?

AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("PixelCoordMode", 0)

While 1
   $Coord = PixelSearch (470, 291, 515, 324, 0x585858, 5)
   If Not @error Then
   MouseClick ( "Left" , 434, 533 , 1 , 0 )
   EndIf
Wend
Edited by zappiezap
Link to comment
Share on other sites

You must understand your script... If you don't there is no point. Do you even know why you have AutoItSetOption("MouseCoordMode", 0) at the top of your script?

Go to the help file and search for AutoItSetOption() > MouseCoordMode and read.

Edited by Burrup

qq

Link to comment
Share on other sites

  • Moderators

Sounds like he's using the 'wrong' MouseCoordMode to me.

If he looks in his auto info tool, under Options / Coord Mode he will probably see that he has checked the "Screen" choice or the "Client" choice, but he is calling the "Active" window Choice with MouseCoordMode, 0.

Probably just needs to be MouseCoordMode, 1 or MouseCoordMode, 2

Hope this helps!!

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

**UPDATE**

Ron , your way worked, but now it just clicks like heck i dont even think i looks for the pixel it just clicks unlimited where i wanted it to click once if it saw the pixel.. any help?

Edited by zappiezap
Link to comment
Share on other sites

Obvious again... It will only EVER click if it finds the pixel... Obviously IT HAS that is why it is clicking... It probably are have the wrong colour or are looking at the wrong pixels. Everything happends for a reason, and seeing as your script you provided is quite small it can't be that to see what is going on. As I said before, understand your script.

qq

Link to comment
Share on other sites

  • Moderators

Obvious again... It will only EVER click if it finds the pixel... Obviously IT HAS that is why it is clicking... It probably are have the wrong colour or are looking at the wrong pixels. Everything happends for a reason, and seeing as your script you provided is quite small it can't be that to see what is going on. As I said before, understand your script.

<{POST_SNAPBACK}>

Absolutely agree with Burrup. Your "shades" must be off. I'm fighting a similar battle myself, If I had 1/2 the knowledge that Burrup has, my glass would be at least half full :( .

Just increasing shades until you reach a consistant number. Wish I could tell you that 0xFFFFFF was 10 shades less or greater than 0xFFF700 but I'm just trying to understand them myself this week.

EDIT: Also try changing you PixelCoordMode to , 1 or , 2 whatever you set your MouseCoordMode too

Dunno if that will help but hope it's that easy for you.

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

  • Moderators

Thanks for the compliment :(. But as I must keep repeating, it is essential that you understand your script first, and by 'your' I mean whats in your script, written by you or not.

<{POST_SNAPBACK}>

I agree burrup, but it's obvious he didn't wriite it, you guys have been so helpful to me in the past that I just thought he deserved a point in the right direction. It would of taken me hours a month ago to figure it out, and I know that most of you laughed at me while I did it.... trust me I feel his pain....

You have posted some wonderful stuff, but from this post from others I can tell that you are having one hell of a day!! Cuz if anyone in this Forum other than CyberSlug, Larry, Jde, Yourself or my bud Drache thinks "Outside the Box" I haven't seen it much.

For us Noobs I thank you all!! (and those I didn't mention (gafrost etc... no offense.. but I'm brain dead at the moment).

Now if someone would fix my pixel post I'd be happy!!, J/K... thanks again you guys/gals

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

But, How do i get all close and get the right pixel then? I have spent a little over 3 hours trying to get hotkeys to work, I think its a little impossiable to have it so like the script is always looking for the pixel that i want, and when i dont want it to, just be on pause, then when i want to have it start again just push another button... Maybe i wasnt cut out for this kind of stuff..

Link to comment
Share on other sites

But, How do i get all close and get the right pixel then? I have spent a little over 3 hours trying to get  hotkeys to work, I think its a little impossiable to have it so like the script is always looking for the pixel that i want, and when i dont want it to, just be on pause, then when i want to have it start again just push another button... Maybe i wasnt cut out for this kind of stuff..

<{POST_SNAPBACK}>

Okay you can have the script pause and un pause... Its right in the helpfile. Nothing to figure out.

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d

;;;; Body of program would go here;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc

^^ above code is from the helpfile. Straight copy and paste. Watch how I change the words to be what you want below.

; Press Esc to exit script, Pause/Break to "pause"

Global $Paused
HotKeySet("{PAUSE}", "_Pause")
HotKeySet("{ESC}", "_Exit")
HotKeySet("+!d", "_Start") ;Shift-Alt-d

While 1
    Sleep(100)
WEnd

Func _Pause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd
EndFunc

Func _Exit()
    Exit 0
EndFunc

Func _Start()
    While 1
    ;Your Stuff goes here
    WEnd
EndFunc

I dont mean to be harsh, but I have just read this whole deal and you cant seem to figure out anything. So I hope this helps.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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...