SHARE
TWEET

startup

a guest Aug 20th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("back")
  2. rednet.open("top")
  3. counter = os.startTimer(1)
  4. timeTillSong = 600
  5. playing = "Nothing"
  6. mute = false
  7. secTimeTillSong = 0
  8. minTimeTillSong = 0
  9. timeLeftOnSong = 0
  10. currentlyColour = colours.lime
  11. mcTimeColour = colours.cyan
  12. listeningToColour = colours.grey
  13. songNameColour = colours.magenta
  14. timeTillColour = colours.purple
  15. counterBigColour = colours.red
  16. counterMiddleColour = colours.orange
  17. counterSmallColour = colours.green
  18. welcomeColour = colours.blue
  19.  
  20. while true do
  21.   time = os.time()
  22.   mon.clear()
  23.   mon.setCursorPos(1,5)
  24.   mon.setTextColour(welcomeColour)
  25.   mon.write("Welcome to our base")
  26.   mon.setCursorPos(1,1)
  27.   mon.setTextColour(currentlyColour)
  28.   mon.write("It is currently ")
  29.   mon.setTextColour(mcTimeColour)
  30.   mon.write(textutils.formatTime(time))
  31.   mon.setCursorPos(1,2)
  32.   mon.setTextColour(listeningToColour)
  33.   mon.write("Currently listening to")
  34.   mon.setCursorPos(1,3)
  35.   mon.setTextColour(songNameColour)
  36.   if mute == true then
  37.     mon.write("Music is muted")
  38.   else
  39.     mon.write(playing)
  40.   end
  41.   mon.setCursorPos(1,4)
  42.   mon.setTextColour(timeTillColour)
  43.   mon.write("New song in ")
  44.   if minTimeTillSong > 7 then
  45.     mon.setTextColour(counterBigColour)
  46.   elseif minTimeTillSong > 5 then
  47.     mon.setTextColour(counterMiddleColour)
  48.   else
  49.     mon.setTextColour(counterSmallColour)
  50.   end
  51.   mon.write(math.floor(minTimeTillSong)..":")
  52.   secLeft = tostring(secTimeTillSong)
  53.   if secTimeTillSong < 10 then
  54.     mon.write("0"..secTimeTillSong)
  55.   else
  56.     mon.write(secLeft)
  57.   end
  58.   event, p1,p2,p3 = os.pullEvent()
  59.   if event == "timer" then
  60.     timeLeftOnSong = timeLeftOnSong-1
  61.     secTimeTillSong = secTimeTillSong-1
  62.     if secTimeTillSong < 0 then
  63.       secTimeTillSong = 59
  64.       minTimeTillSong = minTimeTillSong-1
  65.     end
  66.     if timeLeftOnSong == 0 then
  67.       playing = "Nothing"
  68.     end
  69.     if secTimeTillSong < 0 and minTimeTillSong < 0 then
  70.       secTimeTillSong = 59
  71.       minTimeTillSong = 9
  72.     end
  73.     if counter ~= nil then
  74.       os.cancelTimer(counter)
  75.     end
  76.     counter = os.startTimer(1)
  77.   elseif event == "rednet_message" and p1 == 746 then
  78.     if p2 == "muted" then
  79.       mute = true
  80.     elseif p2 == "unmute" then
  81.       mute = false
  82.     else
  83.       minTimeTillSong = 9
  84.       secTimeTillSong = 59
  85.     end
  86.     id = p2["id"]
  87.     side = p2["side"]
  88.     if id == 712 then
  89.       if side == "top" then
  90.         playing = "c418 - blocks"
  91.         timeLeftOnSong = 345
  92.       elseif side == "left" then
  93.         playing = "c418 - cat"
  94.         timeLeftOnSong = 183
  95.       elseif side == "right" then
  96.         playing = "c418 - far"
  97.         timeLeftOnSong = 174
  98.       elseif side == "bottom" then
  99.         playing = "c418 - 13"
  100.         timeLeftOnSong = 178
  101.       end
  102.     elseif id == 715 then
  103.       if side == "top" then
  104.         playing = "c418 - stal"
  105.         timeLeftOnSong = 150
  106.       elseif side == "left" then
  107.         playing = "c418 - mellohi"
  108.         timeLeftOnSong = 96
  109.       elseif side == "right" then
  110.         playing = "c418 - strad"
  111.         timeLeftOnSong = 188
  112.       elseif side == "bottom" then
  113.         playing = "c418 - mall"
  114.         timeLeftOnSong = 197
  115.       end
  116.     elseif id == 717 then
  117.       if side == "top" then
  118.         playing = "Valve - Still Alive"
  119.         timeLeftOnSong = 181
  120.       elseif side == "left" then
  121.         playing = "Valve - Want You Gone"
  122.         timeLeftOnSong = 143
  123.       elseif side == "right" then
  124.         playing = "Valve - Radio Loop"
  125.         timeLeftOnSong = 24
  126.       elseif side == "bottom" then
  127.         playing = "Tim Rurkowsi - Wanderer"
  128.         timeLeftOnSong = 302
  129.       end
  130.     elseif id == 747 then
  131.       if side == "top" then
  132.         playing = "???"
  133.         timeLeftOnSong = 190
  134.       elseif side == "left" then
  135.         playing = "Kain Vinosec - Endure Emptiness"
  136.         timeLeftOnSong = 210
  137.       elseif side == "right" then
  138.         playing = "c418 - chirp"
  139.         timeLeftOnSong = 185
  140.       elseif side == "bottom" then
  141.         playing = "c418 - ward"
  142.         timeLeftOnSong = 251
  143.       end
  144.     elseif id == 748 then
  145.       if side == "top" then
  146.         playing = "c418 - wait"
  147.         timeLeftOnSong = 238
  148.       elseif side == "left" then
  149.         playing = "c418 - 11"
  150.         timeLeftOnSong = 71
  151.       elseif side == "right" then
  152.         playing = "Kain Vinosec - Fight For Quiescence"
  153.         timeLeftOnSong = 232
  154.       end
  155.     end
  156.   end
  157. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top