Jump to content
Sign in to follow this  
hck7h60vrmn72

color reading (easy script)

Recommended Posts

hck7h60vrmn72

Hello guys, this is the first time, when i try to use autoit, so i'm a very beginner. Maybe someone can help me?

I'm trying to automate a flash game (not multi player), but something just doesn't work.

script is here:

WinActivate("fishing game")

Sleep(5000)

MouseClick("left", 603, 826) ;here i click on button to start fishing

Sleep(2000)

MouseMove(635, 608); mouse moves to the float

Sleep(1000)

Do

Sleep(1000)

Until Hex(PixelGetColor(635, 608), 6) = "1E70A6" ; the float is colored in red, when fishes drown it, then pointer is pointing to water, witch is blue (1E70A6) and then script must click another button

MouseClick("left", 635, 686); this is the "catch" button

and then i need to put it in a loop. another question, do i have to take coordinates from all monitor of from window only? my browser is maximized to first desktop, so there should be no difference...

screen from game: http://yfrog.com/b9fishesp

Edited by hck7h60vrmn72

Share this post


Link to post
Share on other sites
martin

Hello guys, this is the first time, when i try to use autoit, so i'm a very beginner. Maybe someone can help me?

I'm trying to automate a flash game (not multi player), but something just doesn't work.

script is here:

WinActivate("fishing game")

Sleep(5000)

MouseClick("left", 603, 826) ;here i click on button to start fishing

Sleep(2000)

MouseMove(635, 608); mouse moves to the float

Sleep(1000)

Do

Sleep(1000)

Until Hex(PixelGetColor(635, 608), 6) = "1E70A6" ; the float is colored in red, when fishes drown it, then pointer is pointing to water, witch is blue (1E70A6) and then script must click another button

MouseClick("left", 635, 686); this is the "catch" button

and then i need to put it in a loop. another question, do i have to take coordinates from all monitor of from window only? my browser is maximized to first desktop, so there should be no difference...

screen from game: http://yfrog.com/b9fishesp

You need to tell us what it is that doesn't work. Maybe sleeping for 1 second is too long?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
hck7h60vrmn72

script clicks "start game" button, moves cursor to the float, but when the float disappears (it cought a fish), the monitored pixel color turns to blue, so script should click "catch button" but nothing happens.

Share this post


Link to post
Share on other sites
hck7h60vrmn72

Try just

Until PixelGetColor(635, 608) = 0x1E70A6

I know the help says it returns a decimal value but from experience this still works.

just tried it, but still no luck. script isn't reacting, when the float goes underwater :idea:

Share this post


Link to post
Share on other sites
hck7h60vrmn72

still no luck. i checked the colors and coordinates, everything should be just fine...

one more picture of what is happening.

http://yfrog.com/78fishezzp

Edited by hck7h60vrmn72

Share this post


Link to post
Share on other sites
JohnOne

still no luck. i checked the colors and coordinates, everything should be just fine...

one more picture of what is happening.

http://yfrog.com/78fishezzp

I cant find that colour anywhere on the picture


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
hck7h60vrmn72

I cant find that colour anywhere on the picture

oh, silly me. that was wrong color, now i changed it to blue background color: 0xA57118

but the script still never detects the blue color. i will try some more.

Share this post


Link to post
Share on other sites
hck7h60vrmn72

I could be wrong but I think pixelgetcolor() uses RGB as opposed to BGR

IT WORKS :) you were right and you are the best. the rest illdo myself :idea:

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.