glarson Posted October 25, 2007 Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now