Jump to content

Warhammer Online Runepriest-Bot (very basic)


Nio
 Share

Recommended Posts

Ok, this is my first ever somewhat-complicated Autoit script so be gentle on me. I know bots are a bit frowned upon here but I thought I'd give it a shot and maybe learn a bit from what you guys comment on it.

Basicly it's a farm-bot for the game Warhammer Online (http://www.warhammeronline.com/). There's no pathing on it so it just stays in one place and kills stuff. Current version also requires you have an addon that makes 3 bars for health, actionpoints and target health in the upper left of your screen (more details in the sourcecode itself). I've posted an archive with xHUD and the savedvariables folder for it (instructions inside) that will make the bars show up LINK ,but you may do the same with any unit-frame addon as long as you follow the instructions in the source. This is what it should look like

Features so far:

- checks health before and during fighting and takes steps to heal self

- only attacks if health is ok

- pause function

To Do List:

- figure out how to read health and target health from memory so it doesn't require the addon to work (non-static address, have some pointers to it, can't seem to get the bastards to work outside CE, need help!)

- detection for "target out of range" and "target out of sight" problems

- adding a small randomness to the delays between spell casts to avoid any potential bot-detection they may add in the future

- GUI

- a non-healer version

- World Peace

SOURCE:

;######################################################################################
;#    Nio's Ultra low-tech Warhammer Runepriest BOT
;# ----------------------------------------------------
;# - An opensource Warhammer bot that can farm mobs over and over and over. No movement as of yet, no plans for it. It won't
;#   work without my specific unitframe addon and settings.
;# - REQUIRES a specific unit frame setup (included on the forum thread) to work (because it checks pixels to determine health)
;#   You need 3 bars in the top left corner of your screen (coordinates 0,0) as follows:
;#              1st bar - WHITE COLOR   -   200x5 pixels   -   position 0,0   -  PLAYER HEALTH
;#              2nd bar - YELLOW COLOR  -   200x5 pixels   -   position 0,5   -  PLAYER ACTIONPOINTS
;#              3rd bar - RED COLOR     -   200x5 pixels   -   position 0,10   -  ENEMY HEALTH (must dissapear when no target)
;#          * colors must be pure: RED = 255,0,0; WHITE = 255,255,255; YELLOW = 255,255,0
;# - HOTKEY SETUP:
;#    1      = Rune of Regeneration
;#    3      = Rune of Shielding
;#    4      = Rune of Mending
;#    CTRL+1 = Rune of Immolation
;#    CTRL+2 = Rune of Striking
;#    CTRL+3 = Rune of Fire
;#------------------------------------------------------
;# - Feel free to use it, modify it, flame me about my bad coding (it's my first script ever) and about getting banned etc.
;###########################################################################################
#requireadmin ; won't work in Vista without admin privileges
Global $Paused
Global $Res
Global $combat
HotKeySet("{F1}", "Pause") ; binds the Pause key to pause/unpause the script (it resumes where it was before you paused)
Pause()

While 1 ; The main loop, just keeps running the script over and over
;WinActivate("Warhammer: Age of Reckoning, Copyright 2001-2009 Electronic Arts, Inc.") ;uncomment to make sure warhammer window is always in focus (like if a popup steals focus while you're away, this would fix that problem)
PixelSearch ( 0, 12, 10, 15, 0xFF0000, 1 ); Checks for a red pixel between the specified coordinates to determine if a target is selected (eg. if the target unitframe is visible)
If @error Then ; If no target is selected, then set out of combat variable and find a target
    $combat = "0"
    Target();
Else
    CheckHp(); if there is already a target selected, check health before attacking
EndIf
WEnd ;End Loop

Func Target() ; Target aquisition, just presses TAB
Sleep (300) ; throttling
Send ("{TAB}");
EndFunc ;

Func CheckHp(); Function that checks various spots on the health bar to roughly determine HP status
PixelSearch ( 180, 2, 200, 4, 0xFFFFFF, 1 ); checks 90-100%
If @error Then
HealthHigh();
EndIf;
PixelSearch ( 150, 2, 180, 4, 0xFFFFFF, 1 ); checks 75-90%
If @error Then
HealthMed();
EndIf;
PixelSearch ( 80, 2, 150, 4, 0xFFFFFF, 1 );40-75%
If @error Then ; if it doesn't find a pixel within those percentages it means health must be low
HealthLow();
EndIf;
If Not @error Then
Fight() ; if pixels are found all over it means health is 100% and it can issue the Fight function
EndIf;
EndFunc;

; Various functions to execute when health is High/Med/Low. These will have to be modified if you're using a different actionbar setup than the one I use or if you wanna modify for a non-healer etc.
Func HealthHigh() ;
    ToolTip( '', 400, 0) ;
    ToolTip( 'High' & $combat, 400, 0) ;
    Sleep(500);
EndFunc;

Func HealthMed() ;
ToolTip( '', 400, 0) ;
ToolTip( 'Med' & $combat, 400, 0) ;
Send ("{1}");
Sleep(50);
If $combat = "0" Then ; checks if you're in combat so that it only waits for healing to work if you're not (otherwise it'd be waiting for your health to regen while you're fighting.. not too good)
    Sleep(3000);
Else
    Send ("{3}");
EndIf
EndFunc;

Func HealthLow() ;
ToolTip( '', 400, 0) ;
ToolTip( 'LOW' & $combat, 400, 0) ;
Send ("{1}");
If $combat = "0" Then
    Sleep(15000);
Else
    Send ("{3}");
    Sleep(200);
    Send ("{4}");
    Sleep(3000);
EndIf
EndFunc;

Func Pause() ;pause function, stolen from another bot on the forum. it just makes the script wait 100 miliseconds over and over and over while it's paused, that way when you unpause it just keeps going from where it was instead of starting all over again
$Paused = Not $Paused ;
While $Paused ;
Sleep(100) ; Pause
ToolTip( 'SCRIPT PAUSED' & $combat, 300, 0) ;
WEnd ;
ToolTip("") ;
EndFunc ;

;Fighting function, here it's just PRESS 1, WAIT 1 second, PRESS 3, WAIT 1 second.. etc. You can modify this to suit your actionbar setup of if you wanna alter it for another class
Func Fight();
$combat = "1";
Sleep (9)
Send("!1")
Sleep(1000);
Send("!3")
Sleep(1000)
Send("!2")
Sleep(4000);
Send("!3")
Sleep(1000);
Send("!1")
Send("!3")
Sleep(1000);
Send("!2")
Sleep(5000);
Send("!3")
EndFunc
Edited by Nio
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...