Jump to content

Little gamebot, but need help


ClockWise
 Share

Recommended Posts

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

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.

Link to comment
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.

Link to comment
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
Link to comment
Share on other sites

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

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...