Jump to content
Sign in to follow this  
NomadByNature

If, Then, Repeat, Having issues

Recommended Posts

NomadByNature

Hello everyone, thanks in advance for your help, I am having a few small issues with getting this script finished. Unlike, most others, i will post the script first, then explain what i want it to do, and ask my quetsions.

While 1
sleep(5000)
MouseClick("left", 362, 146,)
Sleep(3000)
    
        If PixelGetColor (984, 229) = 0xCCCCCC Then
           sleep(5000)
           MouseClick("left", 362, 146,)
           Sleep(3000)
            Exitloop
        Else
            MouseClick("left", 520, 287,)
            ExitLoop 
        EndIf

WEnd
Exit

It is a basic (well it would seem that it should be anyways) click, check then do either this, or, that kind of thing.

1. It is to wait 5 seconds and left click at coord. 362, 146

2. it is to wait 3 seconds then check to see if the color of the pixel at 984,229 is CCCCCC

3. if it IS then it is to repeat steps 1 & 2 until the pixel is NOT CCCCCC

4. If it IS NOT, then it is to left click at coord. 520,287

My Problem,

I can make it click at 362, 146

I have not tested to see if it actually checks the pixel as i cant get it to repeat steps 1&2 to verify

As written it will not "loop" steps 1& 2 until the If variable is met to proceed ( the pixel is no longer CCCCCC and it is to click at 520,287)

I am sure there are all kinds of issues with the way i have posted this, but this is my first ever post, i have been using the Autoit software for simple automations for almost 6 months and always been able to find the answer to my ?'s by searching google or these forums, and this is the first time i have hit a dead end.

Would someone please EXPLAIN to me what i need to modify. I wouldnt mind if someone posted a script that does what i am looking to do, but if you do please explain why you did your code the way you did, i am not looking for a "freebie" and am not one of those "hey guys i'm lazy, write me a code" script kiddies. i am looking for assistance, so i can learn, not for somone to just do it for me without explaining where i was going wrong.

Thanks again for your help, (in advance)

Share this post


Link to post
Share on other sites
Edano

is it to automate a game ?


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
Hawkysoft

remove the exitloops.... you kill your loop when you find and not find anything.... that's why

Share this post


Link to post
Share on other sites
NomadByNature

is it to automate a game ?

 

No Edano, i'm not much of a gamer. It's so i can use the bathroom or eat dinner without upsetting MY customers, so i can be gone for 10 minutes without putting someone off.

At the first coord is a button on my admin panel that says "refresh" which does just that, If the pixel at the second coord. is CCCCCC that means there are no people waiting to be activated. if the pixel at the second coord IS NOT CCCCCC then there is a button at the 3rd coord. that is labled invite which does just that, sends them my welcome mail and their invitation link.

 

remove the exitloops.... you kill your loop when you find and not find anything.... that's why

 

Thanks seeker, that helped a little bit in makind sense of it, but if i do that on just the  If PixelGetColor (984, 229) = 0xCCCCCC Then MouseClick("left", 362, 146,) will that make it auto loop the "click, check if the pixel is that color, function until the condition result is NO the pixel is not that color.

Share this post


Link to post
Share on other sites
Edano

;http://www.autoitscript.com/forum/topic/153518-if-then-repeat-having-issues/#entry1105513
;Post #1
;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\default_large.png
;by NomadByNature

;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575

While 1
    Do
        sleep(5000)
        MouseClick("left", 362, 146)
        Sleep(3000)
    Until PixelGetColor (984, 229) <> 0xCCCCCC
    MouseClick("left", 520, 287)
WEnd


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
NomadByNature
;http://www.autoitscript.com/forum/topic/153518-if-then-repeat-having-issues/#entry1105513
;Post #1
;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\default_large.png
;by NomadByNature

;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575

While 1
    Do
        sleep(5000)
        MouseClick("left", 362, 146)
        Sleep(3000)
    Until PixelGetColor (984, 229) <> 0xCCCCCC
    MouseClick("left", 520, 287)
WEnd

Thank you soo much for that, it is getting me in the right direction and making more sense, but even after toying with different (false) values, it leaves me stuck on the following.

When i run the script, it clicks the initial value the "refresh button" and it appears that it checks the second coordinants for the color CCCCCC, but then when it detects that the pixel at the second coord. IS CCCCCC it clicks the 520,287 coord, as where i want it to repeat until the pixel at 984,229 IS NOT CCCCCC, then click at 520,287. from my months of tinkering, i know i need to change the ( Until PixelGetColor (984, 229) <> 0xCCCCCC ) to a false value meaning when it is NOT that color click the final Coord.

So i guess to summarize my question, what is the correct way to script a false, or IS NOT variable in this manner?

Share this post


Link to post
Share on other sites
Edano

no, the function is correct, it loops until the color is not 0xcccccc anymore. maybe you should check the coordinates and the color, but the script does what you said.

<> means IS NOT

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
NomadByNature

no, the function is correct, it loops until the color is not 0xcccccc anymore. maybe you should check the coordinates and the color, but the script does what you said.

<> means IS NOT

 

Edano, You sir are an absolute genious. I spent an hour researching because i thought that <> ment false as well but it wasnt working, only to read your comment and double check the color to find out that my Decimal to Hex converter was wrong. Thank you soooo, much. lets hope i can get through the rest of this without issues.

Share this post


Link to post
Share on other sites
Edano

cool. in fact, you can use decimal as well. it doesn't matter.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

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  

×