Advertisement
Guest User

startup

a guest
Sep 25th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. --Server
  2. --Settings
  3. local bkgColour = colors.cyan --Timer text colour
  4. local txtColour = colors.yellow --Timer background colour
  5. local duration = 30 --Time in minutes
  6. --
  7. local scId = 13
  8.  
  9. local fSec
  10. local fMin
  11. local fTime
  12.  
  13. --Client Init
  14. rednet.open('back')
  15. rednet.send(scId,"update")
  16. rednet.send(scId,bkgColour)
  17. rednet.send(scId,txtColour)
  18. --rednet.send(scId,
  19. function timeFormat(int)
  20.   if (int == 0) or (int == 60) then
  21.     return "00"
  22.   elseif int < 10 then
  23.     return "0"..tostring(int)  
  24.   else
  25.     return tostring(int)
  26.   end
  27.  
  28. end
  29. rednet.send(scId,tostring(duration)..":00")
  30. cmd = read()
  31. if cmd == "run" then
  32. for min = 0,duration do
  33.   min = min + 1
  34.   fmin = duration - min
  35.   for sec = 0,59 do
  36.     sleep(1)
  37.     sec = sec + 1  
  38.     fsec = 60 - sec
  39.     fTime = timeFormat((fmin))..":"..timeFormat((fsec))
  40.     rednet.send(scId,fTime)
  41.     --sleep(1)
  42.     --sec = sec + 1
  43.   end
  44.   --min = min +1
  45. end
  46. elseif cmd == "bkg" then
  47.   Print("enter new background colour:")
  48.   newC = read()
  49.   bkgColor = "colors."..newC
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement