Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum Goto page Previous  1, 2
Loftaris Posted: Wed Aug 18, 2010 2:09 pm
Help turning a % into a time
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sun Dec 18, 2011 12:01 am   
 
File: . Line: 6 Col: 9 Error: Invalid element name: "
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sun Dec 18, 2011 12:01 am   
 
oops sorry, unsure how to delete this one.. firefox froze.
File: . Line: 6 Col: 9 Error: Invalid element name: "
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Dec 18, 2011 12:27 am   
 
Oh, the reason why is because the forum changes the html entities into their > and < counterparts, which messes things up. I forgot about that. Instead, I'll just step you through it.

1. Create the trigger: Likelihood of Flux: (%f)~%
2. Change the language to Lua (top right corner, dropdown box).
3. Copy/paste the stuff below into the value box.

Code:
local function addZero(n)
  if n < 10 then
  n = "0" .. n
  end
  return n
end

totalsecs = ((100-zs.param(1))/100)*3600
totalmins = math.floor(totalsecs/60)
remaindersecs = math.floor(totalsecs%60)
fluxtime = os.time()+totalsecs
fluxhour = os.date('*t',fluxtime).hour
fluxmin = os.date('*t',fluxtime).min
fluxsec = os.date('*t',fluxtime).sec

if fluxhour > 12 then
fluxhour = fluxhour - 12
fluxap = "p"
else
fluxap = "a"
end

zs.sayadd(" [ " .. totalmins .. "m " .. addZero(remaindersecs) .. "s (" .. fluxhour .. ":" .. addZero(fluxmin) .. "." .. addZero(fluxsec) .. fluxap .. ") ]")


That should do what you need to do.
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sun Dec 18, 2011 1:16 am   
 
You sir, are awesome.

I truly appreciate your patience, and thank you so very much!

Best holiday season to you, whichever you choose to celebrate!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net