Sign in to follow this  
Followers 0
Kyloob

find color and click question

5 posts in this topic

Hey =D

I have a problem that's been bugging me a bit, I'm a 100% novice AutoIt coder so I know literally nothing apart from what I've picked up in the last hour or two.

I'm making a script that hopefully goes to locations on a screen, checks the color of those locations, and if they are the correct color, it goes to another location and clicks, and this constantly loops. Simple eh? Well no, I seem to have messed it up somehow. Any advice would be greatly appreciated.

While 1
If PixelGetColor ( 364, 370) = "255, 0, 0" Then
    MouseMove ( 290, 560)
    MouseClick ("left")
ElseIf PixelGetColor ( 398, 372) = "255, 255, 0" Then
    MouseMove ( 415, 560) 
    MouseClick ("left")
ElseIf PixelGetColor ( 376, 370) = "144, 238, 144" Then
    MouseMove ( 555, 560) 
    MouseClick ("left")
ElseIf PixelGetColor ( 357, 370) = "144, 238, 144" Then
    MouseMove ( 555, 560) 
    MouseClick ("left")
EndIf
WEnd

The script just doesn't seem to do anything apart from lag out my PC a bit.

Share this post


Link to post
Share on other sites



Hey =D

I have a problem that's been bugging me a bit, I'm a 100% novice AutoIt coder so I know literally nothing apart from what I've picked up in the last hour or two.

I'm making a script that hopefully goes to locations on a screen, checks the color of those locations, and if they are the correct color, it goes to another location and clicks, and this constantly loops. Simple eh? Well no, I seem to have messed it up somehow. Any advice would be greatly appreciated.

While 1
If PixelGetColor ( 364, 370) = "255, 0, 0" Then
    MouseMove ( 290, 560)
    MouseClick ("left")
ElseIf PixelGetColor ( 398, 372) = "255, 255, 0" Then
    MouseMove ( 415, 560) 
    MouseClick ("left")
ElseIf PixelGetColor ( 376, 370) = "144, 238, 144" Then
    MouseMove ( 555, 560) 
    MouseClick ("left")
ElseIf PixelGetColor ( 357, 370) = "144, 238, 144" Then
    MouseMove ( 555, 560) 
    MouseClick ("left")
EndIf
WEnd

The script just doesn't seem to do anything apart from lag out my PC a bit.

While 1
If "0x" & Hex(PixelGetColor(364, 370)) = 0xFF0000 Then
    MouseClick ("left",290,560)
ElseIf "0x" & Hex(PixelGetColor(398, 372)) = 0xFFFF00 Then
    MouseClick ("left",415, 560)
ElseIf "0x" & Hex(PixelGetColor(376, 370)) = 0x90EE90 Then
    MouseClick ("left",555, 560)
ElseIf "0x" & Hex(PixelGetColor(357, 370)) = 0x90EE90 Then
    MouseClick ("left",555, 560)
EndIf
WEnd

When the words fail... music speaks

Share this post


Link to post
Share on other sites

Probably the most absurdly fast response I've ever seen, you're a god Andreik. Thanks so much.

I checked the Help file and it only showed me the format of the function, not the format of the response.

Thanks to both of you, its all working fine now, much love =D

Share this post


Link to post
Share on other sites

Probably the most absurdly fast response I've ever seen, you're a god Andreik. Thanks so much.

I checked the Help file and it only showed me the format of the function, not the format of the response.

Thanks to both of you, its all working fine now, much love =D

I am glad that you got it to work, but you may want to read the helpfile more closely in the future, because it say in the page for PixelGetColor()

Success: Returns decimal value of pixel's color

That is clearly in singular and will only be one value. Also the format "255, 0, 0" should have risen suspicion since that isn't used anywhere. And third, you should run the examples and study them, it would have learned you the format much faster than asking on the forum.

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  
Followers 0