shadowsin Posted August 29, 2006 Posted August 29, 2006 ok so i am making a bot for a game how do i make the mouse move to the pixel i want (basically the npc that is wearing that color dress) im still learning so dont flame and help plz
Moderators SmOke_N Posted August 29, 2006 Moderators Posted August 29, 2006 ok so i am making a bot for a game how do i make the mouse move to the pixel i want (basically the npc that is wearing that color dress) im still learning so dont flame and help plzNo flame, look at PixelSearch() in the help file, you'll see it gives an array of coords when the color is found. [0] = x - coord [1] = y - coord So, if we wanted to find a specific color in a 100x100 square starting at 0 x and 0 y it would look something like this: While 1 ; The beginning of a loop to keep looking Local $aPix = PixelSearch(0, 0, 100, 100, 0xFF0000) ;0xFF0000 is the color red If IsArray($aPix) Then ; A conditional statement telling it to only click if the color is found MouseClick('primary', $aPix[0], $aPix[1], 1, 1) ExitLoop ; Now the color was found, it will exit the loop and continue on with whatever else you've written EndIf Sleep(10);Rest the PC WEnd;End Of loop now start over Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
shadowsin Posted August 29, 2006 Author Posted August 29, 2006 (edited) it didnt work. i basically want it to move the mouse from left to right going down till it finds the color was that wat it was supposed to do? Edited August 29, 2006 by shadowsin
Moderators SmOke_N Posted August 29, 2006 Moderators Posted August 29, 2006 do i have to put anything specific or is $apix a default thing? i have looked at other codes and they have other things. and thx for helping becuase that helped me a lotthe $apix "thing" is a variable that will hold the array returned if the color is found. It can be anything that starts with a '$'. But the syntax I used for MouseClick() must be used ([0],[1] with the variable you used to hold the array returned in front of them). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
shadowsin Posted August 29, 2006 Author Posted August 29, 2006 it didnt work. i basically want it to move the mouse from left to right going down till it finds the color was that wat it was supposed to do?
Paulie Posted August 29, 2006 Posted August 29, 2006 (edited) Note, this isn't anything against you personally, nor is it a flame, it is merely a thing to help you be more effective in getting your desired results in future posts.it didnt work. i basically want it to move the mouse from left to right going down till it finds the color was that wat it was supposed to do?it didnt work. i basically want it to move the mouse from left to right going down till it finds the color was that wat it was supposed to do?Now come on, is it really necessary to post the SAME EXACT REPLY twice? and its not even a double post, they are like 10 hours apartim still learning so dont flame and help plzWhatever your scripting experience, it is not an excuse to not use common sense. scripting itself is all about logic, and if you can't logically string together a post capable of explaining both your problem, what you have tried, and the results of your attempts, then you SHOULD NOT be posting. If you have made no attempt, don't expect us to just give you a code because you can smack your keyboard and push "Add Reply"In the future, follow this order of operations before postingOk, so you tried something once, and got an error. Uh-Oh, What now?Read the help file Find a the chunk of your code that you believe to contain the errorFind all the lines in that segment of code that contain information that if changed, could affect your codeFor each line, change some piece of the previous information(From step 2) Test your script, and if you find that this information is not causing the problem, return the changed value back to as it wasRepeat above steps until you are positive that you have either too many errors in your script to solve in this method or until you run out of things to changeRead the help file againSearch the forums with a keyword that is pertinent or related to your scriptSearch the forums again with a new keyword and be sure to check the results beyond just page 1Post on the forums with enough information, so that a person who does not know what you are doing/have done prior to reading your post, will be able to help you. Make sure that your post has evidence that you tried the previous stepsIf at any time your question is answered byThe Reply Smoke gave you contained an example that more then explained everything you need to get you program functioning properly, look at pixelsearch in the help file, and perhaps it will give you the info you need to use Smoke_N's example to solve the problem yourself Edited August 29, 2006 by Paulie
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