TimeRunning function

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

Pragma
a ghoul
a ghoul
Posts: 91
Joined: Sat May 03, 2003 1:45 am

TimeRunning function

Post by Pragma » Sat Jul 05, 2003 2:16 pm

I wanted to implement a function that would measure the time a macro was running, would be helpful for collecting data. However this seeems to not work as intended:

Code: Select all

at program entry point:
 /varset v71 $time(h)
 /varset v72 $time(m)

 /varset v74 $char(level)
 /varset v75 $char(exp)


sub GetRunTime
 
   /if n $v72<=$time(m) /if n $v71<=time(h) {
      /varcalc v72 $time(m)-$v72
      /varcalc v71 $time(h)-$v71
   } 

   /if n $v72>$time(m) /if n $v71<=time(h) {
      /varcalc v72 $time(m)+60-$v72
      /varcalc v71 $time(h)-$v71-1
   } 

   /if n $v72<=$time(m) /if n $v71>time(h) {
      /varcalc v72 $time(m)-$v72
      /varcalc v71 $time(h)+24-$v71
   } 

   /if n $v72>$time(m) /if n $v71>time(h) {
      /varcalc v72 $time(m)+60-$v72
      /varcalc v71 $time(h)+24-$v71-1
   }
   
   /echo Macro ran for $v71 hour(s) and $v72 minute(s)

/return
any ideas?

fwiggles
a hill giant
a hill giant
Posts: 161
Joined: Mon Jun 17, 2002 8:29 pm

Post by fwiggles » Sat Jul 05, 2003 3:53 pm

wouldn't it be easier to use...
$running
Returns the number of seconds the macro has been running
then do the necessary conversions to get hours and minutes etc?
[color=red]Latest survey shows that 3 out of 4 people make up 75% of the world's population.[/color]

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Sat Jul 05, 2003 9:56 pm

Hehe, well look at the bright side fwiggles, by sitting down and making such a macro, you expand your own knowledge of how scripting works :)
That and it's a challenge (perhaps a small one) to make it ;)

But ya, I would use $running too ;p

Pragma
a ghoul
a ghoul
Posts: 91
Joined: Sat May 03, 2003 1:45 am

Post by Pragma » Sun Jul 06, 2003 1:56 am

ARGGGGGGGGGGGG! Foiled by my own ignorance once again! $running! hahaha. Thanks though, not sure why my code didnt work lol, but this makes things easier :)

fwiggles
a hill giant
a hill giant
Posts: 161
Joined: Mon Jun 17, 2002 8:29 pm

Post by fwiggles » Sun Jul 06, 2003 2:35 pm

Expanding knowledge??? PFFFFTTTT who does that anymore
[color=red]Latest survey shows that 3 out of 4 people make up 75% of the world's population.[/color]