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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sat Jul 20, 2013 7:47 pm   

Help with LUA, alarms and using the clock
 
Code:

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

totalsecs = ((100-zs.param(1))/100)*3300
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 .. ") (" .. math.ceil(totalsecs) .. "s) ]")

fluxm = fluxmin
fluxs = flxusec


That is the trigger, what I want to do is set an alarm to alert me when the time is up.

Could anyone help me with that please? This script was coded by someone else on this forum for me, and I don't understand LUA very well.

It would also be appreciative if it would ignore anything less than 5 minutes, and went off 1 minute before the event itself happens.

Pretty please with sugar on top? :)

and thanks!
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Fri Jul 26, 2013 12:25 am   
 
Is there anyone that is able to help me with this, please? :(
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Tue Aug 13, 2013 4:20 pm   
 
I'm still trying to figure out a solution to this trouble, if anyone has any tips that would help I would truly appreciate it.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
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