Spitty13 Posted May 15, 2011 Share Posted May 15, 2011 (edited) Hello all! I've been having a little trouble getting a script click within a certain area. Basically what I want the script to do is find a pixel color(red for example) and if it finds that color then have it search for another pixel (lets say blue). I want the mouse to move to the blue pixel and then I want it to randomly click within a box I designate around the blue pixel. I've been playing around the random function and I can get it to click randomly within a box I make but not when there are parameters after a pixel search. I've also tried using the Mousetrap function and I can't get that to work either. This is what it looks like while 1 If $Active = 1 Then $checkforpixelA = Pixelsearch( 50, 488, 292, 645, 0x015089) $checkforpixelB = Pixelsearch( 273, 765, 914, 954, 0xEBF3FB) if isarray($checkforpixelA Then mousemove($checkforpixelB [0], $checkforpixelB[1], 1) sleep(1000) EndIf EndIf WEndHelp please.au3 Edited May 15, 2011 by Spitty13 Link to comment Share on other sites More sharing options...
Spitty13 Posted May 16, 2011 Author Share Posted May 16, 2011 anyone? Link to comment Share on other sites More sharing options...
JohnOne Posted May 16, 2011 Share Posted May 16, 2011 Explain this "but not when there are parameters after a pixel search" How certain are you that $checkforpixelB is an array? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Spitty13 Posted May 16, 2011 Author Share Posted May 16, 2011 Explain this "but not when there are parameters after a pixel search"How certain are you that $checkforpixelB is an array?Honestly I'm not even sure if the array function is needed. The part posted is just a portion of the whole so it may seem extraneous. The main thing I want is for the pixel search to find a pixel and then have a "box" built around that pixel. I then want the mouse click function to randomly click in that box. Does something like that exist? Link to comment Share on other sites More sharing options...
JohnOne Posted May 16, 2011 Share Posted May 16, 2011 If you can find a pixel and click it, then if you know how addition and subtraction work, that's all you need to make your own function. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Spitty13 Posted May 17, 2011 Author Share Posted May 17, 2011 (edited) Well thanks for helping. I still can't figure it out though. Is there a way to put a random number after a variable So basically is there another way to write this $checkforpixelB = Pixelsearch( 273, 765, 914, 954, 0xEBF3FB) mousemove($checkforpixelB [0], $checkforpixelB[1], 1) re-written so it finds a random number + or - 100 what the pixel search found? Possibly like this? mousemove($checkforpixelB [(random(1,100,1)], $checkforpixelB[(random(1,100,1)], 1) Maybe I'm just asking for something it can not do Edited May 17, 2011 by Spitty13 Link to comment Share on other sites More sharing options...
JohnOne Posted May 17, 2011 Share Posted May 17, 2011 You are passing a variable to MouseMove that most likely does not exist. mousemove($checkforpixelB [(random(1,100,1)] < the number here has a 100/1 chance of being 1, which is the only possible correct element of the array with your random function (MouseMove on success returns [0] and [1]. You need something like mousemove($checkforpixelB[0] + (random(1,100,1), $checkforpixelB[1] + (random(1,100,1)) but with better logic. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now