RotorHead Posted April 20, 2009 Share Posted April 20, 2009 Howdy guys, I'm working on a "bot" for a game. This is what I have so far: expandcollapse popup#RequireAdmin #Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=beta #AutoIt3Wrapper_Res_Comment=This is Beta B.0.0.1 should be more efficient for lvling. Pause/Break Key and Esc Key added. #AutoIt3Wrapper_Res_Description=Less random area scan. #AutoIt3Wrapper_Res_Fileversion=0.0.0.2 #AutoIt3Wrapper_Res_Language=1033 #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** MsgBox(4096,"Info","Now running with admin rights") WinWaitActive ("TwelveSky") ;Variabble dec. follow: $i = 0 $var = PixelGetColor( 451, 36 ) $Chi = PixelGetColor( 102, 27 ) $HP = PixelGetColor( 102, 12 ) $Food = PixelGetColor( 781, 13 ) $Mouse1 = 0 $Mouse2 = 0 ;Working functions follow: Func Chi () $Chi = PixelGetColor( 102, 27 ) If $Chi <> ("0x0851c6") Then Send ("2") Sleep (500) Send ("4") Sleep (500) EndIf EndFunc Func HP () $HP = PixelGetColor( 102, 12 ) If $HP <> ("0xD60400") Then Send ("1") Sleep (500) Send ("3") Sleep (500) EndIf EndFunc Func Food () $Food = PixelGetColor( 781, 13 ) If $Food <> ("0x94BE63") Then Send ("y") Sleep (500) EndIf EndFunc Func Hit () $var = PixelGetColor( 451, 36 ) HP() Chi() Food() MouseClick ("Left") While $var = ("0xF72421") Send ("{F2}") HP() Chi() $var = PixelGetColor( 451, 36 ) WEnd Sleep (500) send ("{e}") Sleep (300) send ("{e}") Sleep (300) send ("{e}") $var = PixelGetColor( 451, 36 ) EndFunc Func Hunt1() HP() Food() Send ("{F7}") MouseMove($Mouse1, $Mouse2) Sleep (100) $var = PixelGetColor( 451, 36 ) If $var = ("0xF72421") then Hit() EndIf If $Mouse1 < 930 or $Mouse2 < 630 Then $Mouse1 = $Mouse1 + 100 $Mouse2 = $Mouse2 + 67 Else $Mouse1 = 0 $Mouse2 = 0 EndIf Sleep (150) send ("{e}") EndFunc Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While 1 Hunt1() If $Mouse1 < 35 and $Mouse2 < 35 Then Send ("{a down}") Sleep (150) Send ("{a up}") Endif WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc So here's my issue... The bot only executes the "Hit()" function if the pointer stops on a target. Is there some way to get the script to run the mouse move and the following check at the same time? $var = PixelGetColor( 451, 36 ) If $var = ("0xF72421") then Hit() EndIf Instead of jumping to the hit function I would be happy if it would just record the mouse position then jump back to that position once the move command has completed. I guess I've asked a lot, sorry, anyway constructive input would be GREAT! Link to comment Share on other sites More sharing options...
bo8ster Posted April 20, 2009 Share Posted April 20, 2009 I'm not a game's person but there are many on the forum. Have a search, i'm sure you will find what your looking for. Also search for DllCall to see how to call Dlls. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2009 Share Posted April 20, 2009 Might want to look at Opt() Mouse coordinates Opt() Pixel color coordinates 8) Link to comment Share on other sites More sharing options...
RotorHead Posted April 21, 2009 Author Share Posted April 21, 2009 Might want to look at Opt() Mouse coordinates Opt() Pixel color coordinates 8)Cool TY! 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