bigassmuffin Posted December 2, 2006 Share Posted December 2, 2006 (edited) NEW PROBLEM, READ MY LAST POST! THANKS FOR YOUR TIME!I see no reason why this wouldn't work, What I want the script to do is explained in the script in notes, but it jsut doenst work!Script:$color = 0xB50400 $game = 0 HotKeySet("+p", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 0, 1023, 651, $color) ;searches screen for color 0xB50400 If IsArray($coord) = 1 Then ;if it finds the color then: MouseMove( $coord[0], $coord[1] - 15, 1, 0) ;move the mouse 15 pixels below color $pos = MouseGetPos() ;and find the postion of where the mouse is. $coord2 = 511-$pos[0], 375-$pos[1] ;find the difference of the position and midscreen. $pos2 = 511-$coord2[0], 375-$coord2[1] ;Goes equidistant from midscreen OPPOSITE direction Mouseclick( "left" , $pos2[0], $pos2[1], 1) ;Clicks left at this position Sleep(500) EndIf EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFuncThanks for your time and help. Edited December 2, 2006 by bigassmuffin Link to comment Share on other sites More sharing options...
Valuater Posted December 2, 2006 Share Posted December 2, 2006 (edited) that was a mess... Maybe $color = 0xB50400 $game = 0 Dim $coord2[3] Dim $pos2[3] HotKeySet("+p", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 0, 1023, 651, $color) ;searches screen for color 0xB50400 If IsArray($coord) = 1 Then ;if it finds the color then: MouseMove( $coord[0], $coord[1] - 15) ;, 1, 0) ;move the mouse 15 pixels below color $pos = MouseGetPos() ;and find the postion of where the mouse is. $coord2[0] = 511-$pos[0] $coord2[1] = 375-$pos[1] ;find the difference of the position and midscreen. $pos2[0] = 511-$coord2[0] $pos2[1] = 375-$coord2[1] ;Goes equidistant from midscreen OPPOSITE direction Mouseclick( "left" , $pos2[0], $pos2[1], 1) ;Clicks left at this position Sleep(500) EndIf EndIf Sleep(1) WEnd Func Play() $game = Not $game EndFunc Func quit() Exit EndFunc **** NOT TESTED $pos = MouseGetPos() is not used 8) Edited December 2, 2006 by Valuater Link to comment Share on other sites More sharing options...
Richard Robertson Posted December 2, 2006 Share Posted December 2, 2006 Instead of using set values for "midscreen", you should divide the width/height by 2. Also, could you tell us what it is not doing? Link to comment Share on other sites More sharing options...
bigassmuffin Posted December 2, 2006 Author Share Posted December 2, 2006 (edited) i dunt got an error anymore, and yours mostly works, its wierd thoguh, it clicks on the red, not equidistance fomr midscreen of the red, thanks thoguh for fast reply and time! nm, works gr8, i jsut had to switch $pos2[0] = 511-$coord2[0] $pos2[1] = 375-$coord2[1] to $pos2[0] = 511+$coord2[0] $pos2[1] = 375+$coord2[1] Edited December 2, 2006 by bigassmuffin Link to comment Share on other sites More sharing options...
herewasplato Posted December 2, 2006 Share Posted December 2, 2006 (edited) Why the comment character here: [NVM - I see why now]MouseMove( $coord[0], $coord[1] - 15) ;, 1, 0) ;move the mouse 15 pixels below colorShouldn't that be $coord[1] + 15MouseMove( $coord[0], $coord[1] - 15) ;, 1, 0) ;move the mouse 15 pixels below coloredit: for nvm comment Edited December 2, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Valuater Posted December 2, 2006 Share Posted December 2, 2006 i dunt got an error anymore, and yours mostly works, its wierd thoguh, it clicks on the red, not equidistance fomr midscreen of the red, thanks thoguh for fast reply and time! nm, works gr8, i jsut had to switch $pos2[0] = 511-$coord2[0] $pos2[1] = 375-$coord2[1] to $pos2[0] = 511+$coord2[0] $pos2[1] = 375+$coord2[1] Glad it works... and plato is correct also thats why i put **** NOT TESTED $pos = MouseGetPos() is not used 8) Link to comment Share on other sites More sharing options...
bigassmuffin Posted December 2, 2006 Author Share Posted December 2, 2006 (edited) Alright, this works great, but I would like the pixel search, $coord = PixelSearch( 140, 140, 883, 627, $color) ;searches screen for color 0xB50400oÝ÷ ÚÇÈ_¦»ayÊ%¢ºÞwbr·w+·Múrh®Úz·nëHÁ©íÛh±æ«rè®X¤{]+yÚbÅélv«£âë(!Ê%¢ºQEÊZËr Thanks for your time! Edited December 2, 2006 by bigassmuffin 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