ClockWise Posted September 27, 2007 Share Posted September 27, 2007 I wrote a very simple game bot, but its not working so good. Heres what i got so far: WinActivate("Game") WinActive("Game") While 1 ControlSend("game","","","{TAB}") Sleep(3000) ControlSend("Game","","","{4}") Sleep(800) ControlSend("Game","","","{3}") Sleep(1400) WEnd TAB is for selecting a monster and 4 is a attackskill same for 3. But my problem is that the app wants to pic another monster before the other are dead. What would be the smartest way to make sure the first monster are dead?. The monster got a HPbar but i cant figure ut how to get the colors. Link to comment Share on other sites More sharing options...
AlmarM Posted September 27, 2007 Share Posted September 27, 2007 (edited) Try HotKeySet HotKeySet("{HOME}", "_Select") ;Press HOME to activate the _Select Func HotKeySet("{ESC}", "_Exit") ;Press ESC to exit Opt("WinWaitDelay", 500) ;The delay for WinWait() is 0.5 seconds If Not WinActive("Game") Then WinActivate("Game") WinWait("Game") While 1 ControlSend("Game", "", "", "{4}") ;Sends 4 into Game Sleep(800) ControlSend("Game", "", "", "{3}") ; Sends 3 into Game Sleep(1400) WEnd Func _Exit() ;Exit Sleep(500) Exit EndFunc Func _Select() '_Select ControlSend("Game", "", "", "{TAB}") Sleep(3000) EndFunc Mayby that will work... And what game you play ?? And welcome to the forum ^^ Edited September 27, 2007 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
ClockWise Posted September 27, 2007 Author Share Posted September 27, 2007 Thanks, but its not working. The problem are that its not selecting a monster, maby it would work with pixelsearch? but as i said in the first post i dont know how to get the colors. Link to comment Share on other sites More sharing options...
qazwsx Posted September 28, 2007 Share Posted September 28, 2007 use the window info tool in scite. Link to comment Share on other sites More sharing options...
ClockWise Posted September 28, 2007 Author Share Posted September 28, 2007 This is how the bot should work. Press TAB wait.. Press 3 wait... press 4 wait... Check 503, 154 for 0x292821 to see if the monster is really dead. then redo the loop.. I got everything except how to check the coords.. i believe it has to be done with pixelgetcolor or pixelsearch. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 28, 2007 Share Posted September 28, 2007 While 1 Send("{TAB}") Sleep(1000) Send("3") Sleep(1000) Send("4") While PixelGetColor(503,154) = 0x292821 Sleep(100) ; Pause Wend Wend github.com/jvanegmond Link to comment Share on other sites More sharing options...
ClockWise Posted September 28, 2007 Author Share Posted September 28, 2007 While 1 Send("{TAB}") Sleep(1000) Send("3") Sleep(1000) Send("4") While PixelGetColor(503,154) = 0x292821 Sleep(100) ; Pause Wend Wend Link to comment Share on other sites More sharing options...
jvanegmond Posted September 28, 2007 Share Posted September 28, 2007 Check the return value of PixelSearch(503, 503, 154, 154, 0x292821) . Like: $sReturn = PixelSearch(503, 503, 154, 154, 0x292821) If Not @error Then ; do stuff EndIF github.com/jvanegmond Link to comment Share on other sites More sharing options...
ClockWise Posted September 28, 2007 Author Share Posted September 28, 2007 Made some changes, but had to give it up. Cant get it to work. I get the Script to select a monster but then its pressing 3,4 and then selects a new one before the first one are dead. Maby if i did the hpbar in 3 stages (HPFULL) -- (HPHALF) -- (HPEMPTY) then press TAB to select a new one. expandcollapse popup;-------------------------------------- ;Bot........ ;-------------------------------------- Global $Paused ;---- Variables Global $PosX = 708;Pos for hpbar, if not killed Global $PosY = 142 ;pos for hpbar, if not killed Global $Hpc = 0xAD2628 ;Color when alive ;- Global $Pos2X = 503 ;pos for hpbar, if killed Global $Pos2Y = 154 ;pos for hpbar, if killed Global $Hpc2 = 0x292821 ;color if killed ;$Al = Archlord ;---- Hotkeys HotKeySet("{F9}","bot_pause") HotKeySet("{F8}","bot_start") ;---- ToolTip ToolTip("Start the bot by pressing (F8). Pause it with (F9).",0,0) Sleep(3000) ;---- Kill function Func bot_start() ToolTip('The bot is currently paused.',0,0) ;--- Activates the Archlordwindow WinActivate("Archlord") WinActive("Archlord") While 1 #cs Press Tab. Check HPFULL if not pres tab.. Sleep press 3 Check HPHALF if true press 4.. Sleep press 4 Check HPEMPTY if true press tab.. Sleep check if the monster are dead.. #CE WEnd EndFunc ;---- Pause function Func bot_pause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('The bot is currently paused.',0,0) WEnd ToolTip("") EndFunc Link to comment Share on other sites More sharing options...
Blue_Drache Posted September 28, 2007 Share Posted September 28, 2007 (edited) what game is that? Part of the problem looks like the area behind the monster's health bar is NOT set to 100% opaque, therefore not allowing you to test for a solid colour. Edited September 28, 2007 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
ClockWise Posted September 28, 2007 Author Share Posted September 28, 2007 Its Archlord. Yes i know about that. But i cant figure out another way to check if the monster really is dead. Link to comment Share on other sites More sharing options...
weaponx Posted September 28, 2007 Share Posted September 28, 2007 When I can't tell if someone is dead I walk up to them and fire a few more rounds / arrows into their skull. Link to comment Share on other sites More sharing options...
ClockWise Posted September 28, 2007 Author Share Posted September 28, 2007 When I can't tell if someone is dead I walk up to them and fire a few more rounds / arrows into their skull.Hehe i do so to, but the bot have to do it . Link to comment Share on other sites More sharing options...
Blue_Drache Posted September 28, 2007 Share Posted September 28, 2007 Ok, so you can't test for the presence of the empty bar THAT way, right? What about testing for the existance for a non-green? (Assuming the health bar is filled with a green line). I'd take the first row of pixels (the one to the extreme left of the bar) and then test it to be anything but green. More often than not, the health bar IS opaque. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
aslani Posted September 28, 2007 Share Posted September 28, 2007 Make sure that your Keybinding in your game sets Tab to Select Nearest Target, this will prevent your bot on selecting new target. As long as the Nearest Target is alive, Tab will always select that target...unless of course you over aggro. :/ [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version 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