Skuller74 Posted November 28, 2005 Posted November 28, 2005 Is there a way i could do something like this? I want to make a script for fishing in WoW for $x = 1 to 9000 MouseClick("Left", "1000", "690", "1") $Variable = Find color 0x000000 (or any other color, where variable will store the coordinates) MouseClick("Right", "X", "Y", "1") - (X and Y from Variable somehow) Sleep(2000) MouseClick("Left", "35, "200", "1") Sleep(1000) so is this possible?
Thatsgreat2345 Posted November 28, 2005 Posted November 28, 2005 ? you want to do that 9000 times why not just do a loop? and someone else can edit your script
Skuller74 Posted November 28, 2005 Author Posted November 28, 2005 I dont know how to do an infinite loop and what do you mean, someone else can edit my script?
LxP Posted November 28, 2005 Posted November 28, 2005 To find a colour you use the PixelSearch() function. An infinite loop is shown in the example below, which assumes that you want to search the entire screen for that pixel.Local $Coords While 1 MouseClick('', 1000, 690, 1, 0) $Coords = PixelSearch(0, 0, @DesktopWidth - 1, @DesktopHeight - 1, 0x000000) If @Error Then ; The colour was not found Else ; The colour was found MouseClick('Right', $Coords[0], $Coords[1], 1, 0) Sleep(2000) MouseClick('', 35, 200, 1, 0) EndIf Sleep(1000) WEnd
Skuller74 Posted November 28, 2005 Author Posted November 28, 2005 of wow thanks oh, and one more thing, since you just said....which assumes that you want to search the entire screen for that pixel.how would you search a limited area?
LxP Posted November 28, 2005 Posted November 28, 2005 To search a limited area you would adjust the first four inputs to PixelSearch() as necessary. AutoIt Window Info gives you the screen coordinates of the mouse which may help you choose the right values.
Skuller74 Posted November 28, 2005 Author Posted November 28, 2005 oh okay, thanks ... and ONE more thing How could I make it search for multiple colors and if it finds ONE of them, go to else. An or statement. I tried this script today and it worked... once because it randomly places the bobber for fishing on the screen so the pixel colors change as it gets closer or farther away. So I want to get many pixels from up close and from farther away.
=sinister= Posted November 28, 2005 Posted November 28, 2005 try using this code- (edited from above) Local $Coords While 1 MouseClick('', 1000, 690, 1, 0) $Coord1 = PixelSearch(0, 0, @DesktopWidth - 1, @DesktopHeight - 1, 0xCOLOR) $Coord2 = PixelSearch(0, 0, @DesktopWidth - 1, @DesktopHeight - 1, 0xCOLOR) ;and so on.. If @Error Then ; The colour was not found Else ; The colour was found MouseClick('Right', $Coord1[0], $Coord1[1], 1, 0) MouseClick('Right', $Coord2[0], $Coord2[1], 1, 0) Sleep(2000) MouseClick('', 35, 200, 1, 0) EndIf Sleep(1000) WEnd
Valuater Posted November 29, 2005 Posted November 29, 2005 this might help you find the color and code and the mouse position expandcollapse popup;*********** Use ************** ; Press Esc to terminate script ; Press F8 to open a color dialog box and choose a color ; Or ; Press F9 to get the color under the mouse pointer ; by Valuater...... Enjoy!!! ;****************************** #include <GuiConstants.au3> #include <Misc.au3> Global $var, $Color_win, $pos HotKeySet("{F8}", "Color_Box") HotKeySet("{ESC}", "Terminate") HotKeySet("{F9}", "Get_Color") ToolTip('Get Color - is Running',0,0) While 1 Sleep(100) WEnd ;;;;;;;; Func Color_Box() $var = _ChooseColor (2) Show_Color() EndFunc Func Terminate() Exit 0 EndFunc Func Get_Color() $pos = MouseGetPos() $Svar = PixelGetColor( $pos[0] , $pos[1]) $var = "0x" & Hex($Svar,6) Show_Color() EndFunc Func Show_Color() GUIDelete($Color_win) ClipPut($var) $Color_win = GUICreate("RGB Color = " & $var, 290, 150, -1, -1) GUISetBkColor($var) GUISetFont(9, 400, -1, "MS Sans Serif") GUICtrlCreateLabel(" This Color has been Copied to the ClipBoard " & @CRLF & @CRLF & " Just Paste it wherever you would like"& @CRLF & @CRLF & @CRLF & " Mouse position X=" & $pos[0] & " Y=" & $pos[1] , 10, 10, 270, 100) GUICtrlSetFont(-1, 9, 650) If $var = 0x000000 Then GUICtrlSetColor( -1, 0xFFFFFF) $OK_Btn = GUICtrlCreateButton("&OK", 100, 110, 80, 30) GUISetState() While 2 $msg1 = GUIGetMsg() If $msg1 = $OK_Btn Or $msg1 = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete($Color_win) EndFunc 8)
=sinister= Posted November 29, 2005 Posted November 29, 2005 yeah, but how do we search for multiple colors so if either color shows up on the screen, it clicks it.
LxP Posted November 29, 2005 Posted November 29, 2005 I tried this script today and it worked... once because it randomly places the bobber for fishing on the screen so the pixel colors change as it gets closer or farther away. So I want to get many pixels from up close and from farther away.PixelSearch() has a shade variation setting. It can detect pixels within a specified range of the given colour. Refer to the help file for more details on that. How could I make it search for multiple colors and if it finds ONE of them, go to else. An or statement.This will do it but it will be twice as slow since it must scan the entire screen twice: Local $CoordsA, $CoordsB While 1 MouseClick('', 1000, 690, 1, 0) $CoordsA = PixelSearch(0, 0, @DesktopWidth - 1, @DesktopHeight - 1, 0x000000) $CoordsB = PixelSearch(0, 0, @DesktopWidth - 1, @DesktopHeight - 1, 0xFFFFFF) If IsArray($CoordsA) Then ; The colour A was found MouseClick('Right', $CoordsA[0], $CoordsA[1], 1, 0) Sleep(2000) MouseClick('', 35, 200, 1, 0) Else ; The colour A was not found EndIf If IsArray($CoordsB) Then ; The colour B was found MouseClick('Right', $CoordsB[0], $CoordsB[1], 1, 0) Sleep(2000) MouseClick('', 35, 200, 1, 0) Else ; The colour B was not found EndIf Sleep(1000) WEnd
Skuller74 Posted November 29, 2005 Author Posted November 29, 2005 (edited) oh alright, that makes sense... thanks man edit: I checked the help file, that shade variation will really help in finding the bobber, thanks Edited November 29, 2005 by Skuller74
Moderators SmOke_N Posted December 3, 2005 Moderators Posted December 3, 2005 (edited) If you're doing a search, I believe Larry posted a PixelSearch that is a bit faster in the Sripts and Scraps part of the forum... Maybe it was in the Idea Lab?EditActually, it was the Developers forum: PixelSearch() Edited December 3, 2005 by SmOke_N 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.
=sinister= Posted December 3, 2005 Posted December 3, 2005 thats too confusing.... it's all about dll stuff...
Moderators SmOke_N Posted December 3, 2005 Moderators Posted December 3, 2005 Well you asked if there was anything faster... you didn't ask if it was simple , but it looks pretty straight up. 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.
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