Jump to content

Problems with making a script


Recommended Posts

I got some questions about this code I made in Autoit:

check the attachments...

1st: In Autoit, the coordinates are (x,y). x counts from left to Right, and y counts from up to down, right?

2nd: Why doesn't the "Do... Until" code work in this script?

3rd: I used a program to get the color of the pixels, do anyone have any idea what the name of these pixel codes are? I'd like to find something to convert them to RGB with.

4th: If you spot any problems, please tell me^^

I'll be greatfull for help^^

Code.au3

Link to comment
Share on other sites

I have no idea what yyou're doing but there where several wierd things in your code that didn't make sense besides that fact that it wont work becuase of an infinite loop. At best-guessing here it what i came up with (maybe it's what you where after)-

Do
    Main()
Until PixelGetColor(743,297)=3745811

func Main()
    if PixelGetColor(562,464)=5789784 Then Q()
    if PixelGetColor(415,422)=3487029 Then W()
    if PixelGetColor(500,409)=6184542 Then E()
    if PixelGetColor(602,419)=11974326 Then R()
    if PixelGetColor(498,405)=5131854 Then T()
    if PixelGetColor(358,426)=8618883 Then Y()
    if PixelGetColor(384,426)=6579300 Then U()
    if PixelGetColor(309,426)=8618883 Then I()
    if PixelGetColor(600,422)=14277081 Then O()
    if PixelGetColor(330,404)=13684944 Then P()
    if PixelGetColor(358,464)=3487029 Then Z()
    if PixelGetColor(316,422)=3487029 Then X()
    if PixelGetColor(560,422)=4934475 Then V()
    if PixelGetColor(270,422)=5789784 Then N()
    if PixelGetColor(268,422)=5789784 Then M()
EndFunc
Func Q()
    If PixelGetColor(194,521)=15521200 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(375,521)=14133597 Then MouseClick( "left" , 400, 525, 1)       
    If PixelGetColor(557,521)=15521200 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func W()
    If PixelGetColor(223,525)=14133597 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(404,525)=14463602 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(586,525)=14133597 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func E()
    If PixelGetColor(206,521)=13935184 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(408,534)=14001236 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(588,526)=15124889 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func R()
    If PixelGetColor(247,530)=16777214 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(420,522)=14000979 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(610,530)=16777214 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func T()
    If PixelGetColor(232,521)=14199391 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(373,538)=15058580 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(593,521)=15256993 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func Y()
    If PixelGetColor(211,521)=16512494 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(393,521)=15058581 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(575,521)=13670720 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func U()
    If PixelGetColor(276,526)=16248284 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(450,530)=15191198 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(639,526)=16248284 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func I()
    If PixelGetColor(224,538)=16314340 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(405,538)=16314340 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(587,538)=16314340 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func O()
    If PixelGetColor(224,521)=16512750 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(405,528)=16710906 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(588,521)=15256735 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func P()
    If PixelGetColor(194,521)=15521200 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(375,521)=14133597 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(557,521)=15521200 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func Z()
    If PixelGetColor(194,521)=15521200 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(375,521)=14133597 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(557,521)=15521200 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func X()
    If PixelGetColor(194,521)=15521200 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(375,521)=14133597 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(557,521)=15521200 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func V()
    If PixelGetColor(194,521)=15521200 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(375,521)=14133597 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(557,521)=15521200 Then MouseClick("left" , 600, 525, 1)    
EndFunc
Func N()
    If PixelGetColor(194,521)=15521200 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(375,521)=14133597 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(557,521)=15521200 Then MouseClick("left" , 600, 525, 1)
EndFunc
Func M()
    If PixelGetColor(194,521)=15521200 Then MouseClick( "left" , 200, 525, 1)           
    If PixelGetColor(375,521)=14133597 Then MouseClick( "left" , 400, 525, 1)           
    If PixelGetColor(557,521)=15521200 Then MouseClick("left" , 600, 525, 1)
EndFunc
Link to comment
Share on other sites

Thank you very much for fixing the "do... until", and making the script alittle simpler^^

Now I must find the RGB colors of the locations, instead of these weird colors-codes I found...

Link to comment
Share on other sites

Just ran the script, now it does not terminate after 0,2 sec^^ But the script seems to be paused automatically at start...Gif.bmp(doin't mind the name of the pic :))

I tried to uncheck it, but it wasn't possible...

The script so far is just like "eviletoaster" posted it...

And btw, how come I couldn't edit my previous post?

Edited by Kuroda
Link to comment
Share on other sites

Left is for left button 200, 525 are the coordinates on the screen (x,y) and 1 is the number of clicks. Is that right?

That's right

And do anyone know why my script pauses?

Doesn't pause on me...note that as soon as you click the icon in the taskbar it will pause though. It is merly in a loop waiting for one of the conditions in main to happen.
Link to comment
Share on other sites

Yes the If Statement will check for True and then continue on, I can see what you are trying to do but i do not understand why.

I would suggest adding controlclicks instead of just clicking at a given location, or if controlclicks are not an option for your environment then a pixelchecksum to find the object to click.

Just for testing purposes I would also suggest adding a way to track the False results as well. that way you can see that your script is actually Cycling through like u want, just not finding any Matches.

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...