glarson 0 Posted October 25, 2007 (edited) 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. CODEFunc _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 October 25, 2007 by glarson Share this post Link to post Share on other sites