Sign in to follow this  
Followers 0
gunnagitcha

need help writing a very basic script

11 posts in this topic

well basically i need it to find the color of a certain location and click it if it is one color and if it is another color to click another location and loop this action...

i figured id take a stab in the dark and attempt to see if i could make some halfass thing work and it didnt so im bringing it here to ask......this is the information and hopefully yall can see what i was trying to do and fix it up for me :P

if PixelGetColor(595,511) = 2C375A

then mouseclick("left" [,595,511]

if PixelGetColor(595,511) = 292929

then mouseclick("left" [,594,556]

Share this post


Link to post
Share on other sites



then should be on the same line as the if , and MouseClick should be like such MouseClick("left",595,511), if u keep the mouseclick on the same line as the then , its ok. But for longer if statements ull have to have an endif as such

If Blah = Blah then
do some code
more code
more code
endif

Share this post


Link to post
Share on other sites

when i changed the script and attempt to run it it gets this error

if PixelGetColor(595,511) = 2C375A

if PixelGetColor(595,511) = ^ERROR

error: Unable to parse line.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

try,

if PixelGetColor(595,511) = Dec(0x2C375A)

edit: just to clarify why...you got the error because hex values have to start with 0x

and had you read the help file, you would know that PixelGetColor returns decimal anyway.

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

when i changed the script and attempt to run it it gets this error

If PixelGetColor(595,511) = 2C375A Then

; SOME CODE HERE

EndIf


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

If PixelGetColor(595,511) = 2C375A Then

; SOME CODE HERE

EndIf

no, like i said above, hex values must begin with 0x, and pixelgetcolor returns decimal anyway, so that would never work. Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

well this is what ive managed to piece together but am still not able to get it working.......it opens the window, but then doesnt ever perform the mouseclicks >.< im an autoit noob and need some help lol

if PixelGetColor(595,511) = Dec(0x2C375A) then 
; sleep(1000)
; MouseClick("left",595,511)
EndIf

if PixelGetColor(595,511) = Dec(0x292929) then
; sleep(1000)   
; MouseClick("left",595,511)
EndIf

Share this post


Link to post
Share on other sites

well this is what ive managed to piece together but am still not able to get it working.......it opens the window, but then doesnt ever perform the mouseclicks >.< im an autoit noob and need some help lol

if PixelGetColor(595,511) = Dec(0x2C375A) then 
; sleep(1000)
; MouseClick("left",595,511)
EndIf

if PixelGetColor(595,511) = Dec(0x292929) then
; sleep(1000)   
; MouseClick("left",595,511)
EndIf
you do know that putting semicolons in the beginning makes the line a comment...right? Remove the semicolons...

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Welcome to AutoIt, you should check this post out to learn the ins and outs specific to it.

Share this post


Link to post
Share on other sites

Welcome to AutoIt, you should check this post out to learn the ins and outs specific to it.

yea im usin that now :D ive had scite for a while and i got the script up and 100% fool proof :P thanks all for helping a noob out

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