Sign in to follow this  
Followers 0
ClockWise

Little gamebot, but need help

15 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

use the window info tool in scite.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

;--------------------------------------
;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

Share this post


Link to post
Share on other sites

#10 ·  Posted (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 by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Its Archlord. Yes i know about that.

But i cant figure out another way to check if the monster really is dead.

Share this post


Link to post
Share on other sites

When I can't tell if someone is dead I walk up to them and fire a few more rounds / arrows into their skull.

Share this post


Link to post
Share on other sites

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 :).

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0