Advertisement
EnderReaper64

Mega Monitor (Computercraft) (Won't work for you because I made it specifically for my world)

Dec 6th, 2021 (edited)
1,207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.23 KB | None | 0 0
  1. -- Computercraft Monitor --
  2. local monitor = peripheral.wrap("back")
  3. term.redirect(monitor)
  4. monitor.setCursorPos(1, 1)
  5. monitor.setBackgroundColor(colors.black)
  6. monitor.clear()
  7. local monitorx, monitory = monitor.getSize()
  8.  
  9. function WriteCenter(Text, ypos)
  10.     local curx, cury = monitor.getCursorPos()
  11.     monitor.setCursorPos(math.floor((monitorx/2)+0.5) - math.floor((string.len(Text)/2)+0.5), ypos)
  12.     monitor.write(Text)
  13. end
  14.  
  15. function GetCenter(Text)
  16.     return (math.floor((monitorx/2)+0.5) - math.floor((string.len(Text)/2)+0.5))
  17. end
  18.  
  19. function RandomColor(randomthing)
  20.     local colors = {
  21.         colors.orange,
  22.         colors.magenta,
  23.         colors.lightBlue,
  24.         colors.yellow,
  25.         colors.lime,
  26.         colors.pink,
  27.         colors.cyan,
  28.         colors.purple,
  29.         colors.blue,
  30.         colors.green,
  31.         colors.red
  32.     }
  33.     if randomthing ~= nil then
  34.         return colors[(randomthing%#colors)+1]
  35.     else
  36.         return colors[math.random(1, #colors)]
  37.     end
  38. end
  39.  
  40. function GetRandomPlayer()
  41.     os.loadAPI("json")
  42.    
  43.     ip="aof6na.alloffabric.com"
  44.    
  45.     str = http.get("https://mcapi.us/server/status?ip="..ip).readAll()
  46.     obj = json.decode(str)
  47.     players = obj.players.sample
  48.  
  49.     term.clear()
  50.     term.setCursorPos(1,1)
  51.     term.setBackgroundColor(colors.gray)
  52.    
  53.     local selected = math.random(1, #players)
  54.     local playername = players[selected]["name"]
  55.     local id = tonumber(string.match(players[selected]["id"], "%d+"))
  56.     if id == nil then
  57.         id = 1
  58.     end
  59.     return playername, id
  60. end
  61. math.randomseed(math.floor((os.epoch("utc")/100)))
  62. doxxedPlayer, doxxedPlayerID = GetRandomPlayer()
  63. DoStuff = 100
  64.  
  65.  
  66. offset = 0
  67.  
  68. while true do
  69.     monitor.setBackgroundColor(colors.black)
  70.     monitor.setTextColor(colors.white)
  71.     monitor.clear()
  72.  
  73.     paintutils.drawFilledBox(1, 1, monitorx, 1, colors.red)
  74.     WriteCenter("Ender OS", 1)
  75.  
  76.     local time = os.time()
  77.     local formattedTime = textutils.formatTime(time, false)
  78.  
  79.     math.randomseed(math.floor(os.epoch("utc")/5000))
  80.     monitor.setCursorPos(1, 1)
  81.     monitor.write(formattedTime)
  82.     monitor.setBackgroundColor(colors.black)
  83.     monitor.setCursorPos(1, 3)
  84.     monitor.write("Your lucky numbers are: ")
  85.     monitor.setTextColor(RandomColor())
  86.     monitor.write(tostring(math.floor(math.random(1, 99))))
  87.     monitor.setTextColor(colors.white)
  88.     monitor.write(", ")
  89.     monitor.setTextColor(RandomColor())
  90.     monitor.write(tostring(math.floor(math.random(1, 99))))
  91.     monitor.setTextColor(colors.white)
  92.     monitor.write(", ")
  93.     monitor.setTextColor(RandomColor())
  94.     monitor.write(tostring(math.floor(math.random(1, 99))))
  95.     monitor.setTextColor(colors.white)
  96.     monitor.write(", ")
  97.     monitor.setTextColor(RandomColor())
  98.     monitor.write(tostring(math.floor(math.random(1, 99))))
  99.     monitor.setTextColor(colors.white)
  100.     monitor.write(", ")
  101.     monitor.setTextColor(RandomColor())
  102.     monitor.write(tostring(math.floor(math.random(1, 99))))
  103.     monitor.setTextColor(colors.white)
  104.  
  105.     monitor.setCursorPos(1, 4)
  106.     monitor.write("Final ")
  107.     monitor.setTextColor(colors.purple)
  108.     monitor.write("GREGIFICATION ")
  109.     monitor.setTextColor(colors.white)
  110.     if (os.epoch("utc")/1000)%110 < 100 then
  111.         monitor.write("in process... (" .. math.floor((os.epoch("utc")/1000)%110)  .. "%)")
  112.     else
  113.         monitor.setTextColor(colors.red)
  114.         monitor.write("FAILED")
  115.     end
  116.     monitor.setTextColor(colors.white)
  117.  
  118.     monitor.setCursorPos(1, 5)
  119.     monitor.write("Is the one piece real? ")
  120.     math.randomseed(math.floor((os.epoch("utc")/1000)))
  121.     if math.random(1, 2) == 1 then
  122.         monitor.setTextColor(colors.lime)    
  123.         monitor.write("YES")    
  124.     else
  125.         monitor.setTextColor(colors.red)    
  126.         monitor.write("NO")    
  127.     end
  128.     monitor.setTextColor(colors.white)
  129.  
  130.     monitor.setCursorPos(1, 6)
  131.     monitor.write("Doxxing ")
  132.     monitor.setTextColor(RandomColor(doxxedPlayerID))
  133.     monitor.write(doxxedPlayer)
  134.  
  135.     if DoStuff <= 0 then
  136.         math.randomseed(math.floor((os.epoch("utc")/50)))
  137.         doxxedPlayer, doxxedPlayerID = GetRandomPlayer()
  138.         DoStuff = 100
  139.     end
  140.     DoStuff = DoStuff - 1
  141.     os.sleep(0.1)
  142. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement