Author Topic: EUO timing calcs.  (Read 1814 times)

0 Members and 1 Guest are viewing this topic.

Scrripty

  • Guest
EUO timing calcs.
« on: September 17, 2009, 11:21:14 AM »
0
I've never messed with calculating time in EUO before.  So I'm looking at ways to add some interesting timers to my secondary script menu.  There's a 1 second pause in the second script to give the menu a little breathing room, and so it doesn't just rush through, but other than that it's just a loop with a one second pause.  What I need to do is something like this I'm guessing:

Code: [Select]
sub time
set %TimeSpent #scnt - !StartTime

set %Hours ( %TimeSpent / 3600 )
set %Mins  ( %TimeSpent / 60 ) - ( %Hours * 60 )
set %Secs  ( %TimeSpent -

if %PrevHours <> %Hours
{
  set %PrevHours %Hours
  menu delete _Hours
  menu text _Hours %1 %2 %Hours h
}
if %PrevMins <> %Mins
{
  set %PrevMins %Mins
  menu delete _Mins
  menu text _Mins %3 %4 %Mins m
}
if #PrevSecs <> %Secs
{
  set %PrevSecs %Secs
  menu delete _Secs
  menu text _Secs %5 %6 %Secs s
}
RETURN

I'm just having a hard time figuring out how I should use this info to calulate different stats for things in the menu/main script.  And coming up with a way to calc seconds on the menu.  A good way that is.  TM your idea gave me an idea on a WAY to cal seconds... but it wouldn't give me a good way to use it calc real time.  It would just keep track of 60 second intervals... that's not really what I want. :/  You're right.
« Last Edit: September 17, 2009, 11:23:16 AM by Scripty »

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: EUO timing calcs.
« Reply #1 on: September 17, 2009, 11:26:45 AM »
0
Here's one that I wrote that does all the magic for you:

Code: [Select]
;-------------------------------------------------------------------------------
; %1 = input - Time to convert
; #RESULT -  Time converted to #:##:## format
sub TM_ConvertTimeHourMinSec
  namespace push
  namespace local ctime
  set !hourpart %1 / 3600
  set !secpart ( %1 % 3600 ) % 60
  set !minpart ( ( %1 % 3600 ) / 60 )
 
  if !hourpart >= 10
    set #RESULT !hourpart , :
  else
    set #RESULT 0 , !hourpart , :
  if !minpart < 10
    set #RESULT #RESULT , 0
  set #RESULT #RESULT , !minpart , :
  if !secpart < 10
    set #RESULT #RESULT , 0
  set #RESULT #RESULT , !secpart
  namespace pop
return #RESULT

So at the beginning of the script, I make a note of the time %online_start_time

Code: [Select]
  set !temp #SCNT - %online_start_time
  gosub TM_ConvertTimeHourMinSec !temp ; time in H:MM:SS returned in #RESULT

What I typically do is have another counter that I use to update the display.  2, 3, 5, 10 seconds.  Whatever.  But you just monitor this counter to determine when you should call the above code and update the display.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: EUO timing calcs.
« Reply #2 on: September 17, 2009, 11:30:26 AM »
0
Yea, I can do that with someones sub like yours, but what I'm trying to do, is calculate things like, length of time evade has been up.  That's actually pretty easy.  I can just take the amount of seconds it set for in the script, and multiply that by the number of casts on the menu I guess.  That's easy.  But what if I want to calculate something more difficult?  I'm already thinking of easier ways to do this actually just by fudging a bit and not using the ACTUAL times using the info I already have to come up with the "average" times I guess.  I was looking for ways to have the ACTUAL time for things tho.

Tags: