Nighteyez Posted September 16, 2005 Share Posted September 16, 2005 Here is the script itself down below. What the script does is scan a certain size of the screen area. Then launch an active function, it then scans the active area for an item that pops up a tooltip. Then when finding the tooltip, it stops scanning and stays on the target. When the target pops a white flash, it does an auto left click and then selects the item that pops up on the screen. Now, this is NOT my original script, but i've modified a few things for myself.Here is what I was hoping for some help with. In the script, it has a section that when finding the color pure white within a certain area, it "left clicks". Instead, I want it to "[shift] Right-click" on the area. I seem to be blind and can't find that section.The other thing is that instead of it looping and pressing the number 1 key on the keyboard again. I want it to press the "1" key one time at beginning of script. Then after doing the "[shift] Right-click", I want it to start scanning the area of the screen again without pressing "1". And just have it constantly loop that same bit of code.Can anyone help me out here?@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@; Globals $title = "WoW FishBOT" ; Title of game window. $win_title = "World of Warcraft" $top_border_height = 23 $left_border_width = 4 ; How many pixels to move to the right each time. $move_left = 10 ; How many pixels to move down for each run. $move_down = 25 ; Pixels to move back LEFT when bobber is found. ; Note, if the cursor moves TOO far to the left when found, lower this value and vice versa. $found_move_left = 10 ; Pixels to move DOWN when bobber is found. ; Note, if the cursor moves TOO far down when found, lower this value and vice versa. $found_move_down = 5 ; Button to hit for fishing skill. $fishing_pole = 1 ; Set to 0 if you do NOT use the QuickLoot addon from ; http://www.curse-gaming.com/mod.php?addid=132 ; If you ARE using quickloot, set it to 1 $using_quickloot = 1 ; Your resolution. Only 1024x786 & 800x600 supported with without personal modification. $screen_width = 1024 $screen_height = 768 ; Waiting time between throws. $time_to_wait = 30050 ; Display what its doing in traytips.. useful for debugging and/or fun. 1 = on, 0 = off $traytips = 1 dim $start_time ; ******************************************************************************************************** ; Hot Keys HotKeySet("{PAUSE}", "request_end") ; ******************************************************************************************************** if not WinExists($win_title, "") then msg($win_title & " window must be open.") Exit endif WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(500) check_window() ;AutoItSetOption ( "PixelCoordMode", 0 ) $win_pos = WinGetPos($win_title, "") $win_x = $win_pos[0] + $left_border_width $win_y = $win_pos[1] + $top_border_height $top = $win_y + (.25 * $screen_height) $bottom = $top + (.35 * $screen_height) - 1 $left = $win_x + (.15 * $screen_width) $right = $left + $screen_width - (.15 * 2.0 * $screen_width) - 1 ; Here we set the values for the different resolutions. ; I've added a dummy one in the last 'elseif' you can play with ; if you need to, without damaging the default ones. ; If you run 1024 x 768 or 800 x 600, you should not need to modify this. ; For 1024x768 if $screen_width = 1024 and $screen_height = 768 then ; Cordinates to look for the yellow "Fishing Bobber" text. $bobber_text_location_x1 = 458 $bobber_text_location_x2 = 555 $bobber_text_location_y1 = 17 $bobber_text_location_y2 = 18 ; Only used if $quickloot is 0 ! 2 locations it will left click on when looting. ; First location coordinates. $no_quickloot_1_x = 45 $no_quickloot_1_y = 274 ; Second location coordinates. $no_quickloot_2_x = 45 $no_quickloot_2_y = 222 ; For 800x600 elseif $screen_width = 800 and $screen_height = 600 then $bobber_text_location_x1 = 705 $bobber_text_location_x2 = 707 $bobber_text_location_y1 = 557 $bobber_text_location_y2 = 570 $no_quickloot_1_x = 35 $no_quickloot_1_y = 213 $no_quickloot_2_x = 35 $no_quickloot_2_y = 180 ; Dummy. Play here if neeed. elseif $screen_width = 0000 and $screen_height = 0000 $bobber_text_location_x1 = 000 $bobber_text_location_x2 = 000 $bobber_text_location_y1 = 000 $bobber_text_location_y2 = 000 $no_quickloot_1_x = 00 $no_quickloot_1_y = 00 $no_quickloot_2_x = 00 $no_quickloot_2_y = 00 else MsgBox(0, "Resolution Error", "Only 1024x768 and 800x600 are supported without personal modification") Exit endif ; Show a visual confirmation by making the mouse draw the area on the screen ; that will be used to scan for the bobber. traytp("Drawing search area") MouseMove($left, $top, 0) MouseMove($right, $top, 10) MouseMove($right, $bottom, 10) MouseMove($left, $bottom, 10) MouseMove($left, $top, 10) cast_pole() find_float() ; ******************************************************************************************************** func find_float() while 1 ; Reset the $pos back to 0. $pos = 0 if TimerDiff($start_time) >= $time_to_wait then traytp("Resting.. waited long enough") cast_pole() endif sleep(30) ; Move cursor to starting position. MouseMove($top, $left, 1) ; Get its location. Put it in $mousepos_left_next and $mousepos_top_next since those needs to be set ; for the first run. $mousepos = MouseGetPos() $mousepos_left_next = $left $mousepos_top_next = $top ; Loop this until we found the bobber ($pos isnt 0 when found). while $pos = 0 ; Run the move_left function that moves the mouse to the right and looks for it. $pos = move_left($mousepos_left_next, $mousepos_top_next, $top) ; If $pos isnt 0, we found the bobber. if $pos <> 0 then ; Get current cursor position $pos = MouseGetPos() ; Calculate the positions to move the cursor back to. $move_left_to = $pos[0] - $found_move_left $move_top_to = $pos[1] + $found_move_down ; Move the cursor back the number of pixels. MouseMove($move_left_to, $move_top_to, 0) ; We should be close to the bobber now. Start looking for the splash at these coords. traytp("Found bobber at x:" & $move_left_to & " y:" & $move_top_to & " - Waiting for splash") find_splash($move_left_to, $move_top_to) endif ; Bobber wasnt found. Move down the number of defined pixels. $mousepos_top_next = $mousepos_top_next + $move_down ; Check if were at the bottom right border. Bobber wasnt found if so. Restart from beginning. if $mousepos_left_next <= $right then if $mousepos_top_next >= $bottom then $start_time = $time_to_wait exitloop endif endif ; Relax a little. Sleep(20) wend ; Relax a little. Sleep(10) wend endfunc ; Function to move the mouse to the right and looking for the bobber color. func move_left($mousepos_left_next, $mousepos_top_next, $top) traytp("Looking for bobber, at x:" & $mousepos_left_next & " to x:" & $right & " at y:" & $mousepos_top_next) ; Loop until we found the right border. while $mousepos_left_next <= $right ; Search for the bobber text using high tolerance (50) since its still fading in. $pos = PixelSearch($bobber_text_location_x1, $bobber_text_location_y1, $bobber_text_location_x2, $bobber_text_location_y2, 0xFFD200, 50, 1) if @error then ; Not found. Keep going. SetError(0) else ; Found it ! Wait a second to allow it to fade in. traytp("Looks promising at: x:" & $pos[0] & " y:" & $pos[1] & " - examine location.") sleep(1000) ; Search for the bobber text again using less tolerance (5). $pos = PixelSearch($bobber_text_location_x1, $bobber_text_location_y1, $bobber_text_location_x2, $bobber_text_location_y2, 0xFFD200, 5, 1) if @error then ; Hm, not here. Keep looking. False alarm from first search. SetError(0) else ; Found the bobber. Return its position traytp("Found ""Fishing Bobber"" text at: x:" & $pos[0] & " y:" & $pos[1]) return $pos endif endif ; Calculate where to move the mouse to next. $mousepos_left_next = $mousepos_left_next + $move_left ; Move the cursor to the right, using aboves coordinates. MouseMove($mousepos_left_next, $mousepos_top_next, 0) wend ; Nada found. Return $pos 0 so it moves down a bit and restarts the search. return 0 endfunc ; ******************************************************************************************************** func find_splash($float_x, $float_y) $search_left = $float_x - 32 $search_right = $search_left + 62 $search_top = $float_y - 32 $search_bottom = $search_top + 64 ; Usually you do not have to modify the search color for the splash, as the pixels ; have a very distinctive, bright color. $splash_color = 0xF6F6F6 ; Sometimes 30 tolerance works well, sometimes 20 is better in lit areas to avoid catching highlights ; in other things. $splash_tolerance = 20 ; The search step can be pretty small here (1 to 3) without worries because the search area is ; so small once it has been narrowed down - speed isn't much of an issue. $splash_search_step = 2 ; Search for splash while TimerDiff($start_time) < $time_to_wait $pos = PixelSearch($search_left, $search_top, $search_right, $search_bottom, $splash_color, $splash_tolerance, $splash_search_step) if @error then SetError(0) else ; Click on the splash traytp("Got splash at x:" & $pos[0] & " y:" & $pos[1] & " - Loot it.") MouseClick("right", $pos[0], $pos[1], 1, 2) if $using_quickloot = 0 then MouseMove($no_quickloot_1_x, $no_quickloot_1_y, 0) traytp("Looting at x:" & $no_quickloot_1_x & " y:" & $no_quickloot_1_y & " in 3 seconds") Sleep(3000) MouseClick("left", $no_quickloot_1_x, $no_quickloot_1_y, 2, 2) traytp("Looting at x:" & $no_quickloot_2_x & " y:" & $no_quickloot_2_y & " soon") Sleep(200) MouseMove($no_quickloot_2_x, $no_quickloot_2_y, 0) Sleep(200) MouseClick("left", $no_quickloot_2_x, $no_quickloot_2_y, 1, 2) else traytp("Looting at x:" & $pos[0] & " y:" & $pos[1] & " in 3 seconds") Sleep(3000) MouseClick("left", $pos[0], $pos[1], 1, 2) traytp("Looting again just in case, at x:" & $pos[0] & " y:" & $pos[1] & " in 0.9 seconds") Sleep(900) MouseClick("left", $pos[0], $pos[1], 1, 2) endif Sleep(1100) MouseMove($left, $bottom, 2) ExitLoop endif Sleep(10) wend ; Cast pole and start all over again. cast_pole() endfunc ; ******************************************************************************************************** func cast_pole() $start_time = TimerInit() traytp("Pressing " & $fishing_pole & " to cast pole") Send($fishing_pole) Sleep(1000) endfunc ; ******************************************************************************************************** func check_window() $dimensions = WinGetClientSize($win_title, "") if $dimensions[0] <> $screen_width or $dimensions[1] <> $screen_height then msg("Invalid window size. You must use " & $screen_width & "x" & $screen_height & " resolution in window mode.") Exit endif endfunc ; ******************************************************************************************************** func msg($text) MsgBox(0, $title, $text) endfunc func traytp($text) if $traytips = 1 then TrayTip ($title, $text, 3, 16) endif endfunc ; ******************************************************************************************************** func request_end() $MB_YESNO = 4 $MB_YES = 6 if MsgBox($MB_YESNO, $title, "End script?") == $MB_YES then Exit endif endfunc ; ******************************************************************************************************** func drain_timer() Msg("Restart") $start_time = $start_time - $time_to_wait endfunc ; ********************************************************************************************************@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Thanks for anyone that can help me out! 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