Author Topic: Anyone have a timer sub?  (Read 5331 times)

0 Members and 1 Guest are viewing this topic.

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Anyone have a timer sub?
« on: September 28, 2010, 09:08:10 AM »
0
Something that could be used like this:

Code: [Select]
set %starttime #sCnt

script stuff
gosub TimeCounterUpperSubThatCervWants
event ExMsg #charID 3 0 Script has been running for #RESULT

sub TimeCounterUpperSubThatCervWants
this is what I want right here...
return

So I can just set the beginning time of a script and send that to the sub which will return the Hours:Minutes:Seconds that it's been running. "Script has been running for 1:26:33"
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • 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: Anyone have a timer sub?
« Reply #1 on: September 28, 2010, 09:12:27 AM »
0
Check out the CLAw.  I even have a sub that breaks down the timer into HH:MM:SS
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Anyone have a timer sub?
« Reply #2 on: September 28, 2010, 09:21:55 AM »
0
That's what I'm looking for. Something I can send the start #sCnt to and have it return elapsed time since in the HH:MM:SS format.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • 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: Anyone have a timer sub?
« Reply #3 on: September 28, 2010, 09:26:48 AM »
0
Here's the sub:

Code: [Select]
;-------------------------------------------------------------------------------
; %1 = input - Time to convert
; #RESULT -  Time converted to #:##:## format
sub 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

Just send it your #SCNT - %starttime.

And here it is for OEUO:

Code: [Select]
---------------------------------------------------------------
function ConvertTimeHourMinSec(t)
  local hourpart = math.floor(t / 3600)
  local secpart = math.floor(( t % 3600 ) % 60)
  local minpart = math.floor(( t % 3600 ) / 60)
  local rval = ""
  if hourpart >= 10 then
    rval = hourpart..":"
  else
    rval = "0"..hourpart..":"
  end
  if minpart < 10 then
    rval = rval.."0"
  end
  rval = rval..minpart..":"
  if secpart < 10 then
    rval = rval.."0"
  end
  return rval..secpart
end
« Last Edit: September 28, 2010, 09:28:33 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Anyone have a timer sub?
« Reply #4 on: September 28, 2010, 09:49:59 AM »
0
This will work well with what I'm doing...

Code: [Select]
sub weight_check_send
  set %weight_to_send ( #maxWeight - %weightoffset )
  if #weight <= %weight_to_send
    return

  finditem %leather C_ , #backpackID
  set %hidecount ( %hidecount + #findStack )
  gosub SendItems %leather

  set %runtime ( #sCnt - %start_time )
  gosub ConvertTimeHourMinSec %runtime

  event ExMsg #charID 3 0 %hidecount hides / #RESULT minutes
return

I could even do a hides per hour LOL. Well... maybe I couldn't.... :(
« Last Edit: September 28, 2010, 09:52:18 AM by Cerveza »
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Tidus

  • Lazy
  • Administrator
  • *
  • *
  • Posts: 1291
  • Activity:
    0%
  • Reputation Power: 15
  • Tidus is working their way up.Tidus is working their way up.Tidus is working their way up.
  • Gender: Male
  • Mind Blown
  • Respect: +151
  • Referrals: 2
    • View Profile
    • Ultimate Apparel
Re: Anyone have a timer sub?
« Reply #5 on: September 28, 2010, 10:01:52 AM »
0
you could.  you just have to use your scnt and then divide by how many hides you collected.

convert your scnt to minutes.     math..  (minutes/hides)/60 = HPH


edit: well actually my math might be wrong...  my brain is now fizzling.

edit2: (minutes*hides)/60

bah never mind..  i suck at math.
« Last Edit: September 28, 2010, 10:04:57 AM by Tidus »
For those who have fought for it, freedom has a taste the protected will never know ~ Anonymous, Vietnam, 1968

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Anyone have a timer sub?
« Reply #6 on: September 28, 2010, 10:05:27 AM »
0
LOL I may play with it... make a pop up menu that shows a meter with hides per hour? Nah... heh. I may put it in the event exMsg though.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Tidus

  • Lazy
  • Administrator
  • *
  • *
  • Posts: 1291
  • Activity:
    0%
  • Reputation Power: 15
  • Tidus is working their way up.Tidus is working their way up.Tidus is working their way up.
  • Gender: Male
  • Mind Blown
  • Respect: +151
  • Referrals: 2
    • View Profile
    • Ultimate Apparel
Re: Anyone have a timer sub?
« Reply #7 on: September 28, 2010, 10:08:33 AM »
0
oh oh oh..i think i got the math.    Minutes/60 = %hour         %hides/%hour = HPM  LMAO
For those who have fought for it, freedom has a taste the protected will never know ~ Anonymous, Vietnam, 1968

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Anyone have a timer sub?
« Reply #8 on: September 28, 2010, 10:13:58 AM »
0
Heres what i do   Returns  Days:Hrs:Mins:secs

Code: [Select]
sub ENs_CalculateRunningTime ; %1=ScriptStartTime
  set %Runningtime #scnt - %1
  set %RunningTimedays  %RunningTime / 86400
  set !X %RunningTime - ( %runningtimedays * 86400 )
  set %RunningTimeHrs  %RunningTime / 3600
  set !X %RunningTime - ( %runningtimehrs * 3600 )
  set %RunningTimeMins !x / 60
  set %RunningTimeSecs !x - ( %RunningTimeMins * 60 )
  set %RunningTimeText %RunningTimeDays , : , %RunningTimeHrs , : , %RunningTimeMins , : , %RunningTimeSecs
Return %runningtimeText
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Anyone have a timer sub?
« Reply #9 on: September 28, 2010, 10:16:12 AM »
0
I'll have to use that one EN, since I already have a TM sub in. I want to spread the thanks!
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Anyone have a timer sub?
« Reply #10 on: September 28, 2010, 10:23:11 AM »
0
oh oh oh..i think i got the math.    Minutes/60 = %hour         %hides/%hour = HPM  LMAO
LOL

You finally got it - "hides/(Minutes/60)=hidesperhour"

For example, 1000 hides in 300 minutes:

1000/(300/60) = 1000/5 = 200 hides per hour

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: Anyone have a timer sub?
« Reply #11 on: September 28, 2010, 10:33:15 AM »
0
Lol, it took me a while to get the timer working for my miners menu. Not Gonna Lie! Lol was like GRRRRRRRRRRRRRRRRRRRR
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Anyone have a timer sub?
« Reply #12 on: September 28, 2010, 10:48:43 AM »
0
I could use this coding...

Code: [Select]
if #sCnt = ( %start_time + 3600 )
  display ok It's been an hour, how many hides have you sent?$That's your damn hides per hour, YO
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • 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: Anyone have a timer sub?
« Reply #13 on: September 28, 2010, 10:50:47 AM »
0
I'll have to use that one EN, since I already have a TM sub in. I want to spread the thanks!

I'm kinda anal when it comes to formatting.  I want it to read: 9:02:04 instead of 9:2:4.  ;)
« Last Edit: September 28, 2010, 11:06:43 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • 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: Anyone have a timer sub?
« Reply #14 on: September 28, 2010, 11:02:59 AM »
0
Useful for those who want to do the WHATEVER/HR. computations and show the decimal results:

Code: [Select]
;-------------------------------------------------------------------------------
sub TM_DecimalDivision
  namespace push
  namespace local DEC
  for !i 1 %3
  {
    if !i = 1
      set !places 10
    else
      set !places !places * 10
  }
  set !val ( %1 * !places ) / %2
  set !whole !val / !places
  set !dec !val % !places
  set #RESULT !whole , #dot , !dec
  namespace pop
return #RESULT

Used in my MIB/Hr for example:

Code: [Select]
set %val_dec %mibcount * 3600
set %time #SCNT - %programstarttime
gosub TM_DecimalDivision %val_dec %time 3 ; 3 decimal places
set %formattedmibperhour MIB/hr.: , #SPC , #RESULT

Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: