Advertisement
NeonJ

Redstone Clock

Jul 3rd, 2012
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.25 KB | None | 0 0
  1. monside = "top"
  2. local rRunning = true
  3. local eFlicker = "0"
  4.  
  5. while rRunning do
  6.  local nTime = os.time()
  7.  local rTime = textutils.formatTime(nTime, false)
  8.  local aT = string.sub(rTime, 1, 1)
  9.  local bT = string.sub(rTime, 2, 2)
  10.  local cT = "0"
  11.  local dT = "0"
  12.  local ampm = "AM"
  13.  if bT == ":" then
  14.   bT = aT
  15.   aT = "0"
  16.   cT = string.sub(rTime, 3, 3)
  17.   dT = string.sub(rTime, 4, 4)
  18.   ampm = string.sub(rTime, 6, 7)
  19.  else
  20.   cT = string.sub(rTime, 4, 4)
  21.   dT = string.sub(rTime, 5, 5)
  22.   ampm = string.sub(rTime, 7, 8)
  23.  end
  24.  
  25.  if aT == "0" then
  26.   rs.setBundledOutput("right", colors.red + colors.orange + colors.blue + colors.black + colors.white + colors.yellow)
  27.  elseif aT == "1" then
  28.   rs.setBundledOutput("right", colors.yellow + colors.white)
  29.  end
  30.  
  31.  if bT == "0" then
  32.   rs.setBundledOutput("top", colors.red + colors.orange + colors.blue + colors.black + colors.white + colors.yellow)
  33.  elseif bT == "1" then
  34.   rs.setBundledOutput("top", colors.yellow + colors.white)
  35.  elseif bT == "2" then
  36.   rs.setBundledOutput("top", colors.red + colors. yellow + colors.green + colors.blue + colors.black)
  37.  elseif bT == "3" then
  38.   rs.setBundledOutput("top", colors.red + colors.yellow + colors.green + colors.white + colors.black)
  39.  elseif bT == "4" then
  40.   rs.setBundledOutput("top", colors.orange + colors.green + colors.yellow + colors.white)
  41.  elseif bT == "5" then
  42.   rs.setBundledOutput("top", colors.red + colors.orange + colors.green + colors.white + colors.black)
  43.  elseif bT == "6" then
  44.   rs.setBundledOutput("top", colors.red + colors.orange + colors.green + colors.black + colors.white + colors.blue)
  45.  elseif bT == "7" then
  46.   rs.setBundledOutput("top", colors.red + colors.yellow + colors.white)
  47.  elseif bT == "8" then
  48.   rs.setBundledOutput("top", colors.red + colors.orange + colors.yellow + colors.green + colors.blue + colors.white + colors.black)
  49.  elseif bT == "9" then
  50.   rs.setBundledOutput("top", colors.red + colors.orange + colors.yellow + colors.green + colors.white + colors.black)
  51.  end
  52.  
  53.  if cT == "0" then
  54.   rs.setBundledOutput("bottom", colors.red + colors.orange + colors.blue + colors.black + colors.white + colors.yellow)
  55.  elseif cT == "1" then
  56.   rs.setBundledOutput("bottom", colors.yellow + colors.white)
  57.  elseif cT == "2" then
  58.   rs.setBundledOutput("bottom", colors.red + colors. yellow + colors.green + colors.blue + colors.black)
  59.  elseif cT == "3" then
  60.   rs.setBundledOutput("bottom", colors.red + colors.yellow + colors.green + colors.white + colors.black)
  61.  elseif cT == "4" then
  62.   rs.setBundledOutput("bottom", colors.orange + colors.green + colors.yellow + colors.white)
  63.  elseif cT == "5" then
  64.   rs.setBundledOutput("bottom", colors.red + colors.orange + colors.green + colors.white + colors.black)
  65.  elseif cT == "6" then
  66.   rs.setBundledOutput("bottom", colors.red + colors.orange + colors.green + colors.black + colors.white + colors.blue)
  67.  elseif cT == "7" then
  68.   rs.setBundledOutput("bottom", colors.red + colors.yellow + colors.white)
  69.  elseif cT == "8" then
  70.   rs.setBundledOutput("bottom", colors.red + colors.orange + colors.yellow + colors.green + colors.blue + colors.white + colors.black)
  71.  elseif cT == "9" then
  72.   rs.setBundledOutput("bottom", colors.red + colors.orange + colors.yellow + colors.green + colors.white + colors.black)
  73.  end
  74.  
  75.  if dT == "0" then
  76.   rs.setBundledOutput("left", colors.red + colors.orange + colors.blue + colors.black + colors.white + colors.yellow)
  77.  elseif dT == "1" then
  78.   rs.setBundledOutput("left", colors.yellow + colors.white)
  79.  elseif dT == "2" then
  80.   rs.setBundledOutput("left", colors.red + colors. yellow + colors.green + colors.blue + colors.black)
  81.  elseif dT == "3" then
  82.   rs.setBundledOutput("left", colors.red + colors.yellow + colors.green + colors.white + colors.black)
  83.  elseif dT == "4" then
  84.   rs.setBundledOutput("left", colors.orange + colors.green + colors.yellow + colors.white)
  85.  elseif dT == "5" then
  86.   rs.setBundledOutput("left", colors.red + colors.orange + colors.green + colors.white + colors.black)
  87.  elseif dT == "6" then
  88.   rs.setBundledOutput("left", colors.red + colors.orange + colors.green + colors.black + colors.white + colors.blue)
  89.  elseif dT == "7" then
  90.   rs.setBundledOutput("left", colors.red + colors.yellow + colors.white)
  91.  elseif dT == "8" then
  92.   rs.setBundledOutput("left", colors.red + colors.orange + colors.yellow + colors.green + colors.blue + colors.white + colors.black)
  93.  elseif dT == "9" then
  94.   rs.setBundledOutput("left", colors.red + colors.orange + colors.yellow + colors.green + colors.white + colors.black)
  95.  end
  96.  
  97.  if eFlicker == "1" then
  98.   rs.setBundledOutput("back", colors.black)
  99.   eFlicker = "0"
  100.  else
  101.   rs.setBundledOutput("back", 0)
  102.   eFlicker = "1"
  103.  end
  104.  sleep(1)
  105.  end
  106.  
  107. --    111     RRR                        AAAAA  M   M     A = RED
  108. --   2   3   O   Y                       A   A  MM MM     P = ORANGE
  109. --   2   3   O   Y                       A   A  M M M     M = YELLOW
  110. --    444     GGG                        AAAAA  M   M
  111. --   5   6   B   W                       A   P  M   M
  112. --   5   6   B   W                       A   P  M   M
  113. --    777     KKK                        A   P  M   M
  114. --    LEFT   TOP   :   BOTTOM   RIGHT    ampm: BACK
  115. --
  116. --   1 = RED
  117. --   2 = ORANGE
  118. --   3 = YELLOW
  119. --   4 = GEREN
  120. --   5 = BLUE
  121. --   6 = white
  122. --   7 = BLACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement