Sign in to follow this  
Followers 0
gui529

cant get timers right.

4 posts in this topic

#1 ·  Posted (edited)

Hey I have been writing this script for a while. I toke parts of other scripts to make it. but anyways here it is...K let me now explain

Its a bot for a game called Archlord, basically what is set to do is.

Prebuff

then it perform the attack HOWEVER...since archlord has buffs that are important for survival i want it to buff 3 spells with different timers...and that is my problem

the bot prebuffs and then attacks fine after i press PAUSE...however i cant get the "rebuff" to work...i know its becaues of the loop and it never lets the function be called but i tried a lot of things and I cant manage to make it work because of my low experience in autoit and programming in general.

basically i want the func buff1 to work all the time and stay on

Global $UnPaused 
HotKeySet("{PAUSE}", "TogglePause") 
HotKeySet("{END}", "Terminate")
$GameTitle = "Archlord"
Dim $BuffTimer1   = 2;===== seconds of Buff 1                   
Dim $BuffTimer2   = 528;===== seconds of Buff 2                   
Dim $BuffTimer3   = 528;===== seconds of Buff 3


WinWaitActive($GameTitle)


;====CREATE TIMERS FOR BUFFS=====
Func begin()

$timer1 = TimerStart()
$timer2 = TimerStart()
$timer3 = TimerStart()
Sleep ( 150 )
$timer1 = TimerStart()
$timer2 = TimerStart()
$timer3 = TimerStart()
ToolTip("Timers SET!! ", 0, 0)
Sleep(1000)
EndFunc



;=======PRE-Buffing========


    ToolTip("Buffing ", 2, 0)
        Sleep(2000)
        ControlSend($GameTitle, "", "", "{f5}")
        Sleep(2100)
    ToolTip("Buffing ", 2, 0)
        ControlSend($GameTitle, "", "", "{f6}")
        Sleep(2700)
    ToolTip("Buffing ", 2, 0)
        ControlSend($GameTitle, "", "", "{f7}")
        Sleep(1800)  

;=====ENDS PRE-BUFFING=======

;=====START TIMERS!!!=======
Func start()
$timer1 = timerstart()
Endfunc


$timer1 = timerinit()




;====BOT STARTS BUT ITS PAUSED!

While 1 
    Sleep(10) 
    ToolTip("  Bot is Paused  Press {Pause} To Resume, ****",0,0) 
WEnd 

;=========FUNCTION THAT STARTS/PAUSES========


Func TogglePause() 
    $UnPaused = NOT $UnPaused 
    While $UnPaused 
        ToolTip("Bot Runing.",0,0) 
        
      Sleep(100 + Random(1, 300)) 
    
    ControlSend($GameTitle, "", "", "{TAB}")
    sleep(500)
    ControlSend($GameTitle, "", "", "{f1}")
    sleep(13000)
    WEnd 
EndFunc  

;=====FUNCTION THAT EXITS BOT===========
Func Terminate() 
    Exit 0 
EndFunc

;========K LETS RE- BUFF 1  lol============



Func buff1()
if timerdiff($timer1) > $BuffTimer1 * 1000 then
ControlSend($GameTitle, "", "", "{f5}")
$timer1 = timerinit()
endif

Endfunc
Edited by gui529

Share this post


Link to post
Share on other sites



Hey I have been writing this script for a while. I toke parts of other scripts to make it. but anyways here it is...K let me now explain

Its a bot for a game called Archlord, basically what is set to do is.

Prebuff

then it perform the attack HOWEVER...since archlord has buffs that are important for survival i want it to buff 3 spells with different timers...and that is my problem

the bot prebuffs and then attacks fine after i press PAUSE...however i cant get the "rebuff" to work...i know its becaues of the loop and it never lets the function be called but i tried a lot of things and I cant manage to make it work because of my low experience in autoit and programming in general.

basically i want the func buff1 to work all the time and stay on

I don't know what you want to do with the timers and there is no function TimerStart so I have ignored that. I changed the way pause is dealt with which might help. Not tested!

; Author - gui529
; Link - http://www.autoitscript.com/forum/index.php?showtopic=91141&view=findpost&p=655594
Global $UnPaused = false

HotKeySet("{END}", "Terminate")
$GameTitle = "Archlord"
Dim $BuffTimer1 = 2;===== seconds of Buff 1                 
Dim $BuffTimer2 = 528;===== seconds of Buff 2                     
Dim $BuffTimer3= 528;===== seconds of Buff 3


WinWaitActive($GameTitle)
HotKeySet("{PAUSE}", "TogglePause");don't let toggl ehappen until game is started

;====CREATE TIMERS FOR BUFFS=====
Func begin()
#cs
    $timer1 = TimerStart()
    $timer2 = TimerStart()
    $timer3 = TimerStart()
    Sleep(150)
    $timer1 = TimerStart()
    $timer2 = TimerStart()
    $timer3 = TimerStart()
    #ce
    
    ToolTip("Timers SET!! ", 0, 0)
    Sleep(1000)
EndFunc  ;==>begin



;=======PRE-Buffing========


ToolTip("Buffing ", 2, 0)
Sleep(2000)
ControlSend($GameTitle, "", "", "{f5}")
Sleep(2100)
ToolTip("Buffing ", 2, 0)
ControlSend($GameTitle, "", "", "{f6}")
Sleep(2700)
ToolTip("Buffing ", 2, 0)
ControlSend($GameTitle, "", "", "{f7}")
Sleep(1800)
ConsoleWrite("past sleeps" & @CRLF)
;=====ENDS PRE-BUFFING=======

;=====START TIMERS!!!=======
Func start()
 ;  $timer1 = timerstart()
EndFunc  ;==>start


$timer1 = TimerInit()




;====BOT STARTS BUT ITS PAUSED!
TogglePause();turn pause off and show tooltip
While 1
    Sleep(10)
    If $UnPaused Then
        
        Sleep(100 + Random(1, 300))
        ControlSend($GameTitle, "", "", "{TAB}")
        Sleep(500)
        ControlSend($GameTitle, "", "", "{f1}")
        Sleep(13000)
    EndIf
WEnd

;=========FUNCTION THAT STARTS/PAUSES========

Func TogglePause()
    $UnPaused = Not $UnPaused
    ConsoleWrite($Unpaused & @CRLF)
    If $UnPaused Then
        ToolTip("Bot Runing.", 0, 0)
    Else
        ToolTip("  Bot is Paused  Press {Pause} To Resume, ****", 0, 0)
    EndIf
EndFunc  ;==>TogglePause


;=====FUNCTION THAT EXITS BOT===========
Func Terminate()
    Exit 0
EndFunc  ;==>Terminate

;========K LETS RE- BUFF 1  lol============



Func buff1()
    If TimerDiff($timer1) > $BuffTimer1 * 1000 Then
        ControlSend($GameTitle, "", "", "{f5}")
        $timer1 = TimerInit()
    EndIf

EndFunc  ;==>buff1

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Why not setup a script that reading off everything, and after one go through, it will then have the appro of the time it involves. I have done this when I was on Archlord, it would incorporate everything any spell/skill you could think of, because I do know having all your spells on can be the difference in fighting mobs 3 levels higher really easy.


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

Here is the layout of mine

Local $avSlots[18 + 1][3 + 1]
    
    For $iCombat = 0 to 18 Step 1
        
        If $iCombat < 10 Then
            $iCombatSpot = PixelGetColor(($wCoord[0] + 246) + (($iCombat + 1) * 52), $wCoord[1] + 744)
        Else
            $iCombatSpot = PixelGetColor(($wCoord[0] + 246) + (($iCombat - 9) * 52), $wCoord[1] + 744)
        EndIf

        Switch $iCombat
            Case 18
                $sTempCombat = "+{+}"
            Case 17
                $sTempCombat = "+{-}"
            Case 16
                $sTempCombat = "+0"
            Case 10 To 15
                $sTempCombat = "+" & $iCombat - 7
            Case 9
                $sTempCombat = "+"
            Case 8
                $sTempCombat = "-"
            Case 7
                $sTempCombat = "0"
            Case 0 To 6
                $sTempCombat = $iCombat + 3
        EndSwitch
            
        $avSlots[$iCombat][0] = $sTempCombat
        $avSlots[$iCombat][1] = $iCombatSpot
        $avSlots[$iCombat][2] = $iCombat
        $avSlots[$iCombat][3] = 0
                
    Next
            
    _ArrayDisplay($avSlots, "Class List of Active Window")oÝ÷ Ù8^)íç(u殶­s`f÷"b33c¶6öÖ&BÒFòb33c¶6÷VçFW"7FW bVÄvWD6öÆ÷"b33c·t6ö÷&E³Ò²#Cb²b33c¶e6Æ÷G5²b33c¶6öÖ&EÕ³%Ò²¢S"Âb33c·t6ö÷&E³Ò²sCBÓÒb33c¶e6Æ÷G5²b33c¶6öÖ&EÕ³ÒFVà 6ÆVW&æFöÒÃ# b33c¶$67FVBÒG'VP b33c¶67FVDÖv2Òb33c¶6öÖ&@ 6VæBb33c¶e6Æ÷G5²b33c¶6öÖ&EÕ³Ò b33c·uFÖW$67FVDÖv2ÒFÖW$æB WDÆö÷ VæD` æW@  bb33c¶$67FVBÓÒG'VRFVà b33c·uFÖW$FffW&Væ6RÒFÖW$Ffbb33c·uFÖW$67FVDÖv2 bb33c·uFÖW$FffW&Væ6RfwC³Òb33c¶e6Æ÷G5²b33c¶67FVDÖv5Õ³5ÒFVà b33c¶$67FVBÒfÇ6P VæD` VæD

If you want the whole thing message me on msn, myspace,yahoo


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

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