Jump to content

Timer macro


glarson
 Share

Recommended Posts

I have not been able to figure out what is going wrong with this function for keeping track of the time in my macro. All of it works except for the average time. Here is the scripts, if anyone can see an issue I would greatly appriciate the help.

CODE
Func _TimeToString($timestamp)

Local $_time, $_h, $_m, $_s, $_message

$_time = Round($timestamp / 1000, 0)

$_h = Int($_time / 3600)

$_m = Int(($_time - $_h * 3600) / 60)

$_s = $_time - $_h * 3600 - $_m * 60

If ($_h > 0) Then

$_message = StringFormat("%02d:%02d:%02d", $_h, $_m, $_s)

ElseIf ($_m > 0) Then

$_message = StringFormat("%02d:%02d", $_m, $_s)

ElseIf ($_s > 0) Then

$_message = StringFormat("%02d", $_s)

Else

$_message = ""

EndIf

Return $_message

EndFunc

Func DoTimer()

Local $iTotalTime = 0, $iAvrageTime = 0

Local $sTotalTime = 0, $sAvrageTime = 0

Local $_Message = "", $_Pattern = ""

If ($BotTimer > 0) Then

$iTotalTime = TimerDiff($BotTimer)

$sTotalTime = _TimeToString($iTotalTime)

EndIf

If (GetStatus() = 1) Then

$iAvrageTime = ($iTotalTime / $BotCycles)

$sAvrageTime = _TimeToString($iAvrageTime)

EndIf

$_Pattern = "Total Time: %s" & @CRLF & "Cycle: %d" & @CRLF & "Avrage Cycle Time: %s"

$_Message = StringFormat($_Pattern, $sTotalTime, $BotCycles, $sAvrageTime)

GUICtrlSetData($EveGUI_TimerLine, $_Message)

EndFunc

Edited by glarson
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...