Sign in to follow this  
Followers 0
powderedonuts

New to auto it, need help with "If" command script

11 posts in this topic

Hi I'm trying to incorporate into my script a command that is dependent on the color of a specific pixel on my screen.

Could someone who is good at this help me out please? Basically I have a script right now for pressing space every few seconds,

and I want to add in a variable that if a specific pixel on my screen was green, it would execute some button press commands, and if

it wasn't green, would just do nothing and continue pressing space on a loop.

How can I write in a command that is dependent on the color of a specific pixel? I can find out the coords for the pixel if you can help

me for where to input them in a script, if what I want to do is possible. Thank you much!

(Very new to this, one day, been reading the tutorials but im not the best at computery stuff.)

Share this post


Link to post
Share on other sites



oh sorry sorry, here it is.

HotKeySet("{F9}","Start")

HotKeySet("{F10}","End")

While 1

Sleep(100)

WEnd

Func Start()

While 1

Sleep(40000 + Random(1, 50, 1))

Send("{SPACE}")

Sleep(200)

Send("{SPACE}")

Sleep(18000 + Random (4000, 6000, 1))

Wend

EndFunc

Func End()

Exit

EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Maybe:

HotKeySet("{F9}", "Start")
 HotKeySet("{F10}", "End")
 
 While 1
     Sleep(100)
 WEnd
 
 Func Start()
     If Hex(PixelGetColor( 10, 100 ), 6) <> 0xFF00FF Then Return ; 0xRRGGBB
 
     While 1
         Sleep(40000 + Random(1, 50, 1))
         Send("{SPACE}")
         Sleep(200)
         Send("{SPACE}")
         Sleep(18000 + Random(4000, 6000, 1))
     WEnd
 EndFunc   ;==>Start
 
 Func End()
     Exit
 EndFunc   ;==>End

EDIT: change X,Y and color accordingly

Edited by Zedna

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

ok I checked out the getcolor command,

and the pixel color I want it to check for and execute movements on is

pixel: 90,142

dec color: 29696

hex color: 007400

So now how can I make a command that will only execute when pixel 90, 142 is this color?if the pixel is not that color

I want it only to continue my space loop.

tyvm for the help so far!

edit: oh and the command I want to add in is some arrow movements then pressing the "1" button, if you wanted to know

Edited by powderedonuts

Share this post


Link to post
Share on other sites

So now how can I make a command that will only execute when pixel 90, 142 is this color?if the pixel is not that color

I want it only to continue my space loop.

Look at my previous post :-)

Share this post


Link to post
Share on other sites

ugh Im really bad I need help on how to input the colors.

HotKeySet("{F9}", "Start")

HotKeySet("{F10}", "End")

While 1

Sleep(100)

WEnd

Func Start()

If Hex(PixelGetColor( 90, 142 ), 6) <> 0xFF00FF Then Return ; 0x007400

Send("{SPACE}")

Sleep(200)

Send("{SPACE}")

Sleep(200)

While 1

Sleep(40000 + Random(1, 50, 1))

Send("{SPACE}")

Sleep(200)

Send("{SPACE}")

Sleep(18000 + Random(4000, 6000, 1))

WEnd

EndFunc ;==>Start

Func End()

Exit

EndFunc ;==>End

this is wrong right? I want the two SPACE to be conditional on the color

Share this post


Link to post
Share on other sites

Oh thx very much im going to try this out now, and by arrow I meant actually like holding down the arrow key on the keyboard for a little while, but I think I can get that in there myself.

Share this post


Link to post
Share on other sites

Alright it worked, I pressed space and "1" based on the green pixel, thank you.

Now I am writing in the command for the arrow press.

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