MildWarlock Posted November 15, 2007 Posted November 15, 2007 (edited) This is a NosTale bot written by Labrinth http://forum.cheatengine.org/viewtopic.php...asc&start=0 Nostale is a free MMO http://www.nostale.co.uk/ I added some features to it, but some where ive done somthing wrong. and im not sure what i did. Would some one mind looking over this code. A second pair of eyes usualy helps. Also, is there a command to search for a picture on screen and then force a mouse click on it? expandcollapse popup#Include <Misc.au3> Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4); <-- exact title Match or it doesnt run the bot Opt("WinDetectHiddenText", 1) Opt("PixelCoordMode", 2); <--- this is why pixel coords was wrng too. Opt("MouseCoordMode", 2);<--- This is why your coords was not right. ;~ Below is how it targets only the game window WinWait("NosTale", "") If Not WinActive("NosTale", "") Then WinActivate("NosTale", "") WinWaitActive("NosTale", "") ;~ Hold END To stop the bot HotKeySet("{END}", "Terminate") $pickupitems = 0 $ColorHP = 0 $ColorLHP = 0 $ColorMP = 0 While $pickupitems = 0 Sleep(1000) Send("{` 20}");use auto pickup;~ Send("{~ 10}");Presses the ~ key 10 times for picking up items $ColorHP = PixelGetColor(150, 36);Dont know if this Loc is valid. Coding at work and dont have access to nostale here so im guessing $ColorLHP = PixelGetColor(130, 36) $ColorMP = PixelGetColor(130, 46);Mana Bar again just a guess on location for now If $ColorHP = 592137 Then;Checking For low HP $ColorHP = 0 Sleep(2000) Send("{c Down}") Sleep(500) Send("{c Up}") Sleep(40000);healing time "how long he sits" 20 seconds Send("{c Down}") Sleep(500) Send("{c Up}") Sleep(1000) If $ColorMP = 592137 Then;Checking For low MP $ColorMP = 0 Sleep(2000) Send("{c Down}") Sleep(500) Send("{c Up}") Sleep(40000);Med time same as healing time "how long he sits" 20 seconds Send("{c Down}") Sleep(500) Send("{c Up}") Sleep(1000) Else Sleep(1000) Send("{Space 2}");use to auto fight pressing Space, 2 times sleep(100) Send ("{q Down}");Skill 1 = Q 2 = W 3 = E Sleep(500) Send ("{q Up}") sleep(100) Send ("{w Down}") Sleep(500) Send ("{w Up}") sleep(100) Send ("{e Down}") Sleep(500) Send ("{e Up}") If $ColorLHP = 592137 Then;Checking For very low HP while fighting $ColorLHP = 0 Sleep(2000) Send("{r Down}") Sleep(500) Send("{r Up}");Helth pot location on toolbar = R Else Sleep(1000) Send("{Space 2}");use to auto fight pressing Space, 2 times Sleep(7000) EndIf EndIf EndIf WEnd ;~ Terminates the bot Func Terminate() $MB_MsgBoxButtons = 5;What buttons that show in messagebox 5 = Retry and Cancel $MB_Cancel = 2;What button is pressed to exit the script 2 = Cancel, If Cancel buton is pushed the script stops. If MsgBox($MB_MsgBoxButtons, "You Stopped the Bot!", "Retry or Cancel the bot?") == $MB_Cancel Then Exit EndIf EndFunc ;==>Terminate in addition to the orgional bot i wanted to add Ive been playing with Lab's Bot here. Im at work and i cannot even launch the script or even have Nostale installed.(Somthing about the managment saying we would waist time playing games /shrug). Im still new to autoit3, and i end up missing somthing simple. So if anyone wants to take a look at it and test it for me here is the source What i added (hopefully) Is Mana support if you are low on mana you should sit same as health. Raised the limit at which you will sit and rest. If your helth goes to low while fighting the bot will press 'R' that is where you want to place snacks or potions. also added ' q' 'w' 'e' presses for skills.. This mostlikly will need the sleep modifyed depending on the skill. The loc I used for the mana bar is a guess and may need relocated Edited November 15, 2007 by MildWarlock
MildWarlock Posted November 15, 2007 Author Posted November 15, 2007 (edited) What errors do you get? I am writing this at work, and this PC has Au3 blocked (bastards) while I can write it I cannot test it.. The -if- -then- -else- statments seem wrong to me but I can't test it to find out. I was hoping some one would be able to test for me Edited November 15, 2007 by MildWarlock
Fend Posted November 18, 2008 Posted November 18, 2008 (edited) I found that if you take a screen shot of your desktop at home with the nostale client set at pixel 0,0 then you can track the correct pixel posistions while coding at work. Use the window tool in autoit to get that posistion. Looking at the code I noticed that you have an mp check only if your hp is low...perhaps you want them seperated... ;;;;;;;;HP CHECK If PixelGetColor == $ColorHP Then $ColorHP = 0 ... ... ... EndIf ;;;;;;;;MP CHECK If PixelGetColor == $ColorMP Then $ColorMP = 0 ... ... ... EndIf The If Else would work for heal or fight but I would probably just do it like If hp then heal if mp then heal fight Since you will fight anyway it doesnt have to really be an else... Hopefully this helps, I have a few bots with some more advanced features and would be happy to run through some theory/code if you want. Good Luck on the bot! Edited November 18, 2008 by Fend I like cookies?
bansotet123 Posted January 13, 2009 Posted January 13, 2009 hi..i'm new to autoit... i have copy and paste the code to notepad and save...imy problem is i don't know what to do to make this code run...could anyone be kind enough to teach me at my YM: kristoffer_dy@yahoo.com CODE#Include <Misc.au3> Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4); <-- exact title Match or it doesnt run the bot Opt("WinDetectHiddenText", 1) Opt("PixelCoordMode", 2); <--- this is why pixel coords was wrng too. Opt("MouseCoordMode", 2);<--- This is why your coords was not right. ;~ Below is how it targets only the game window WinWait("NosTale", "") If Not WinActive("NosTale", "") Then WinActivate("NosTale", "") WinWaitActive("NosTale", "") ;~ Hold END To stop the bot HotKeySet("{END}", "Terminate") $pickupitems = 0 $ColorHP = 0 $ColorLHP = 0 $ColorMP = 0 While $pickupitems = 0 Sleep(1000) Send("{` 20}");use auto pickup;~ Send("{~ 10}");Presses the ~ key 10 times for picking up items $ColorHP = PixelGetColor(150, 36);Dont know if this Loc is valid. Coding at work and dont have access to nostale here so im guessing $ColorLHP = PixelGetColor(130, 36) $ColorMP = PixelGetColor(130, 46);Mana Bar again just a guess on location for now If $ColorHP = 592137 Then;Checking For low HP $ColorHP = 0 Sleep(2000) Send("{c Down}") Sleep(500) Send("{c Up}") Sleep(40000);healing time "how long he sits" 20 seconds Send("{c Down}") Sleep(500) Send("{c Up}") Sleep(1000) If $ColorMP = 592137 Then;Checking For low MP $ColorMP = 0 Sleep(2000) Send("{c Down}") Sleep(500) Send("{c Up}") Sleep(40000);Med time same as healing time "how long he sits" 20 seconds Send("{c Down}") Sleep(500) Send("{c Up}") Sleep(1000) Else Sleep(1000) Send("{Space 2}");use to auto fight pressing Space, 2 times sleep(100) Send ("{q Down}");Skill 1 = Q 2 = W 3 = E Sleep(500) Send ("{q Up}") sleep(100) Send ("{w Down}") Sleep(500) Send ("{w Up}") sleep(100) Send ("{e Down}") Sleep(500) Send ("{e Up}") If $ColorLHP = 592137 Then;Checking For very low HP while fighting $ColorLHP = 0 Sleep(2000) Send("{r Down}") Sleep(500) Send("{r Up}");Helth pot location on toolbar = R Else Sleep(1000) Send("{Space 2}");use to auto fight pressing Space, 2 times Sleep(7000) EndIf EndIf EndIf WEnd ;~ Terminates the bot Func Terminate() $MB_MsgBoxButtons = 5;What buttons that show in messagebox 5 = Retry and Cancel $MB_Cancel = 2;What button is pressed to exit the script 2 = Cancel, If Cancel buton is pushed the script stops. If MsgBox($MB_MsgBoxButtons, "You Stopped the Bot!", "Retry or Cancel the bot?") == $MB_Cancel Then Exit EndIf EndFunc ;==>Terminate
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