ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Cerveza on September 28, 2010, 09:08:10 AM
-
Something that could be used like this:
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"
-
Check out the CLAw. I even have a sub that breaks down the timer into HH:MM:SS
-
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.
-
Here's the sub:
;-------------------------------------------------------------------------------
; %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:
---------------------------------------------------------------
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
-
This will work well with what I'm doing...
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.... :(
-
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.
-
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.
-
oh oh oh..i think i got the math. Minutes/60 = %hour %hides/%hour = HPM LMAO
-
Heres what i do Returns Days:Hrs:Mins:secs
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
-
I'll have to use that one EN, since I already have a TM sub in. I want to spread the thanks!
-
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
-
Lol, it took me a while to get the timer working for my miners menu. Not Gonna Lie! Lol was like GRRRRRRRRRRRRRRRRRRRR
-
I could use this coding...
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
-
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. ;)
-
Useful for those who want to do the WHATEVER/HR. computations and show the decimal results:
;-------------------------------------------------------------------------------
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:
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
-
all i have to say is... your subs make me feel like a mouse next to a cat....
-
all i have to say is... your subs make me feel like a mouse next to a cat....
Well, that's why I share them for everyone to see. I probably thought through that one for an hour at one point. No sense making everyone go through that mental exercise. Plus I'm a nice cat; I only play with the mice and refrain from eating them..
-
No sense making everyone go through that mental exercise
The mental exercise is my favorite part, even if I'm not good at it ;)
X
-
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. ;)
LOL TM... but actually it would be 365:9:2:4 .. incase your script actually runs for a whole year