Satanstheory Posted January 8, 2006 Share Posted January 8, 2006 (edited) Opt('Pixelcoordmode',2) Opt('MouseCoordMode',2) Global $MyGame="---------" Global $Paused HotKeySet("{Pause}","TogglePause") HotKeySet("{ESC}","Terminate") HotKeySet("+!d","ShowMessage") ; Define colour to match Local $Match = 0x161616 ; Loop indefinitely While 1 If Not WinActive($MyGame) Then WinActivate($MyGame) EndIf Local $Coords = PixelSearch(135, 104, 450, 419, 0x161616) If Not @Error And IsArray($Coords) Then MouseClick('Left', $Coords[0], $Coords[1], 1, 1) Do Sleep(400) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf Send ("{INS down}") WEnd Func Togglepause() $Paused = NOT $Paused while $Paused sleep(100) ToolTip(' Bot is Paused Master"Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit EndFunc Func ShowMessage() MsgBox(4096, 'm', 'Terminated'); note the comma after 4096 and quote around 'm'. EndFunc _________________________________________________________________________________________ ok the problem i have is it just keeps targetting diffrent creatures before one is dead. Witch it works good a little buggy somtimes the INS key only stays down now say if i move the Send ("{INS down}") to the top of the code. Before it looks for pixels or after the sleep funection would it always keep the INS key down.? Also how can i get it to Target one till its dead. After they die they dispear.. and it would ethier land on 0x665539 or 0x5D6E21 I was also thinking about implenting a mana potion when Mp gets low.. It would have to look at two diffrent sets of cords something like Local $Coords = PixelSearch(1931, 83, 1990, 91, 0xFF0000) ' to see if the Mp is low If Not @Error And IsArray($Coords) Then Local $Coords = PixelSearch(2092, 25, 2276, 562, 0x527331) MouseClick('Left', $Coords[0], $Coords[1], 2, 1) 'To Double Click i think thats right at least? Do Sleep(1000) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf So my code should look something like this... _________________________________________________________________________________________ Opt('Pixelcoordmode',2) Opt('MouseCoordMode',2) Global $MyGame="--------" Global $Paused HotKeySet("{Pause}","TogglePause") HotKeySet("{ESC}","Terminate") HotKeySet("+!d","ShowMessage") ; Define colour to match Local $Match = 0x161616 ; Loop indefinitely While 1 Send ("{INS down}") If Not WinActive($MyGame) Then WinActivate($MyGame) EndIf Local $Coords = PixelSearch(135, 104, 450, 419, 0x161616) If Not @Error And IsArray($Coords) Then MouseClick('Left', $Coords[0], $Coords[1], 1, 1) Do Sleep(400) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf Local $Coords = PixelSearch(1931, 83, 1990, 91, 0xFF0000) ' to see if the Mp is low If Not @Error And IsArray($Coords) Then Local $Coords = PixelSearch(2092, 25, 2276, 562, 0x527331) MouseClick('Left', $Coords[0], $Coords[1], 2, 1) 'To Double Click Sleep(1000) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf WEnd Func Togglepause() $Paused = NOT $Paused while $Paused sleep(100) ToolTip(' Bot is Paused Master"Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit EndFunc Func ShowMessage() MsgBox(4096, 'm', 'Terminated'); note the comma after 4096 and quote around 'm'. EndFunc ____________________________________________________________________________________ That seem Right? That would solve the mana potion .. But would it interupt my spell casting and i still hahve the problem with it targeting creatures before they are dead? Thanks Alot, Satanstheory Edited January 8, 2006 by Satanstheory Link to comment Share on other sites More sharing options...
Oxin8 Posted January 8, 2006 Share Posted January 8, 2006 (edited) you need it to loop the click in the If statement after it find the pixel. basically, just switch the "Do" and the "MouseClick". That should fix the targeting problem. As for keeping insert down, it's probably the game programing that takes off the effect of the press whenever you move or something to that effect. If you just need it held while it clicks to kill, you could put the send just before it. hope that helps. While 1 If Not WinActive($MyGame) Then WinActivate($MyGame) EndIf Local $Coords = PixelSearch(135, 104, 450, 419, 0x161616) If Not @Error And IsArray($Coords) Then Do MouseClick('Left', $Coords[0], $Coords[1], 1, 1) Sleep(400) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf Send ("{INS down}") WEnd Edited January 8, 2006 by Oxin8 ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Satanstheory Posted January 8, 2006 Author Share Posted January 8, 2006 Getting a Error on WEnd Statement No While? Opt('Pixelcoordmode',2) Opt('MouseCoordMode',2) Global $MyGame="------" Global $Paused HotKeySet("{Pause}","TogglePause") HotKeySet("{ESC}","Terminate") HotKeySet("+!d","ShowMessage") ; Define colour to match Local $Match = 0x161616 ; Loop indefinitely While 1 Send ("{INS down}") If Not WinActive($MyGame) Then WinActivate($MyGame) EndIf Local $Coords = PixelSearch(40, 74, 550, 454, 0xBDBDBB) If Not @Error And IsArray($Coords) Then MouseClick('Left', $Coords[0], $Coords[1], 1, 1) Do Sleep(400) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf Local $Coords = PixelSearch(1931, 83, 1990, 91, 0xFF0000) If Not @Error And IsArray($Coords) Then Local $Coords = PixelSearch(2092, 25, 2276, 562, 0x527331) If Not @Error And IsArray($Coords) Then MouseClick('Left', $Coords[0], $Coords[1], 2, 1) Do Sleep(1000) Until PixelGetColor($Coords[0],$Coords[1]) <> $Match Endif WEnd Func Togglepause() $Paused = NOT $Paused while $Paused sleep(100) ToolTip(' Bot is Paused Master"Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit EndFunc Func ShowMessage() MsgBox(4096, 'm', 'Terminated'); note the comma after 4096 and quote around 'm'. EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 8, 2006 Moderators Share Posted January 8, 2006 (edited) Local $Coords = PixelSearch(1931, 83, 1990, 91, 0xFF0000) << Remove thisIf Not @Error And IsArray($Coords) Then << Remove thisLocal $Coords = PixelSearch(2092, 25, 2276, 562, 0x527331)If Not @Error And IsArray($Coords) ThenMouseClick('Left', $Coords[0], $Coords[1], 2, 1)DoSleep(1000)Until PixelGetColor($Coords[0],$Coords[1]) <> $MatchEndif Edited January 8, 2006 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. Link to comment Share on other sites More sharing options...
Satanstheory Posted January 8, 2006 Author Share Posted January 8, 2006 That worked tho my Mp hasnt got low enough to see if the mp works yet.. But its still auto targeting faster then killing even after i switched the do and mouse click. Link to comment Share on other sites More sharing options...
Satanstheory Posted January 8, 2006 Author Share Posted January 8, 2006 Im not really good with scripting the monsters move around alot so its hard to have it stay targets on just one if you know what i mean its a 2d game. ----------------------------------------------------------------------------------------- Opt('Pixelcoordmode',2) Opt('MouseCoordMode',2) Global $MyGame="--------" Global $Paused HotKeySet("{Pause}","TogglePause") HotKeySet("{ESC}","Terminate") HotKeySet("+!d","ShowMessage") ; Define colour to match Local $Match = 0x161616 ; Loop indefinitely While 1 Send ("{INS down}") If Not WinActive($MyGame) Then WinActivate($MyGame) EndIf Local $Coords = PixelSearch(135, 104, 450, 419, 0x161616) If Not @Error And IsArray($Coords) Then MouseClick('Left', $Coords[0], $Coords[1], 1, 1) Do Sleep(400) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf Local $Coords = PixelSearch(1931, 83, 1990, 91, 0xFF0000) If Not @Error And IsArray($Coords) Then Local $Coords = PixelSearch(2092, 25, 2276, 562, 0x527331) If Not @Error And IsArray($Coords) Then MouseClick('Left', $Coords[0], $Coords[1], 2, 1) do Sleep(1000) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf Func Togglepause() $Paused = NOT $Paused while $Paused sleep(100) ToolTip(' Bot is Paused Master"Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit EndFunc Func ShowMessage() MsgBox(4096, 'm', 'Terminated'); note the comma after 4096 and quote around 'm'. EndFunc _____________________________________________________________ The INS is what cast the spells. But it will keep targeting things before the others are dead. So i was thinking of doing the NOT pixel but with the monsters moving around the small map it would help all that much ill upload a screenshot of the game for a example. I added the second pixel search to see when mp gets low to use a herb to replenshish the mp but i havent run out of mana for awhile cause u only get new spells like every 40 levels so lol.. But the bot is still quite a bit buggy. ---------------------------------------------------------------------------- ____________________________________________________________________________ I could get the bot working for these two cause the foxes leave dead remains and i wasn't sure a way to code around that. Without it always targetting the remains instead of the creatures. The second one i was trying to target the guy with the blue vest i even add a 10 i scan for a 10 pixel shader. But it didnt seem to do anything i dont know why? Also if i increase my resloution does it help Autoit find pixel's Faster? Link to comment Share on other sites More sharing options...
Satanstheory Posted January 9, 2006 Author Share Posted January 9, 2006 Was thinking about what you said about removing them to Local $Coords = PixelSearch(1931, 83, 1990, 91, 0xFF0000) ;searches a small area to see if it turns red for MP. If Not @Error And IsArray($Coords) Then Local $Coords = PixelSearch(2092, 25, 2276, 562, 0x527331) ; After Mp Turns Red It locateds a Herb If Not @Error And IsArray($Coords) Then MouseClick('Left', $Coords[0], $Coords[1], 2, 1) do Sleep(1000) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf If i remove the First set it wont scan the right area to see when the mp turns red. The second set of code CHECKs for a mp potion to use. But its giving me a error on my pause Func instead on that code maybee i should change Endif to WEnd? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 9, 2006 Moderators Share Posted January 9, 2006 For every If/Then Statement you need an EndIf Statement if you are trolling it down like that. You only had one EndIf... I thought by telling you to take that out you might notice the difference, and if it were needed put the EndIf there under the other EndIf. 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. Link to comment Share on other sites More sharing options...
Satanstheory Posted January 9, 2006 Author Share Posted January 9, 2006 Yea i added that but im still getting errors Local $Coords = PixelSearch(1931, 83, 1990, 91, 0xFF0000) ;searches a small area to see if it turns red for MP. If Not @Error And IsArray($Coords) Then EndIf Local $Coords = PixelSearch(2092, 25, 2276, 562, 0x527331) ; After Mp Turns Red It locateds a Herb If Not @Error And IsArray($Coords) Then EndIf MouseClick('Left', $Coords[0], $Coords[1], 2, 1) do Sleep(1000) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match WEnd Also if i want to do a number of Searches for mutliple creatures to target would it look like this. Local $Coords = PixelSearch(135, 104, 450, 419, 0x161616) If Not @Error And IsArray($Coords) Then MouseClick('Left', $Coords[0], $Coords[1], 1, 1) Do Sleep(400) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf Local $Coords = PixelSearch(135, 104, 450, 419, 0x078854d) If Not @Error And IsArray($Coords) Then MouseClick('Left', $Coords[0], $Coords[1], 1, 1) Do Sleep(400) Until PixelGetColor($Coords[0], $Coords[1]) <> $Match EndIf I believe that is right. not sure tho. The mp have to connect to each other like. If i Find Red i look for a herb to double click. But for some reason its messing with my Pause Func. and other error's driving me nuts. 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