Advertisement
Laine_prikol

Simple Screensaver

Jan 29th, 2017
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.49 KB | None | 0 0
  1. -- Simple screensaver by Laine_prikol
  2. local component = require("component")
  3. local gpu = component.gpu
  4. local os = require("os")
  5. local term = require("term")
  6. input = "None"
  7. -----------------------------
  8. term.clear()
  9. print("Введите режим: [a] - Полный рандом [b] - Красный [c] - Синий [d] - Зелёный")
  10. while true do
  11. input = io.read()
  12.     if input == "a" then
  13.     term.clear()
  14.         while true do
  15.         os.sleep(0)
  16.         local x = math.random(0, 160)
  17.         local y = math.random(0, 80)
  18.         local x1 = x + math.random(0,10)
  19.         local y1 = y + math.random(1,5)
  20.         local x2 = x + math.random(1,8)
  21.         local y2 = y + math.random(2,5)
  22.         gpu.set(x,y, "█")
  23.         gpu.setForeground(0x0000FF)
  24.         gpu.set(x1,y1, "▓")
  25.         gpu.setForeground(0x008000)
  26.         gpu.set(x2,y2, "░")
  27.         gpu.set(x2+4,y2+5, " ")
  28.         gpu.setForeground(0x008000)
  29.         gpu.set(x2+2,y2+1, "█")
  30.         gpu.setForeground(0xF00000)
  31.         end
  32.     end
  33.     if input == "b" then
  34.     term.clear()
  35.         while true do
  36.         os.sleep(0)
  37.         local x = math.random(0, 160)
  38.         local y = math.random(0, 80)
  39.         local x1 = x + math.random(0,10)
  40.         local y1 = y + math.random(1,5)
  41.         local x2 = x + math.random(1,8)
  42.         local y2 = y + math.random(2,5)
  43.         gpu.set(x,y, "█")
  44.         gpu.setForeground(0xff0000)
  45.         gpu.set(x1,y1, "█")
  46.         gpu.setForeground(0xff1a1a)
  47.         gpu.set(x2,y2, "█")
  48.         gpu.set(x2+4,y2+5, " ")
  49.         gpu.setForeground(0xe60000)
  50.         gpu.set(x2+2,y2+1, "█")
  51.         gpu.setForeground(0xff8080)
  52.         end
  53.     end
  54.     if input == "c" then
  55.     term.clear()
  56.         while true do
  57.         os.sleep(0)
  58.         local x = math.random(0, 160)
  59.         local y = math.random(0, 80)
  60.         local x1 = x + math.random(0,10)
  61.         local y1 = y + math.random(1,5)
  62.         local x2 = x + math.random(1,8)
  63.         local y2 = y + math.random(2,5)
  64.         gpu.set(x,y, "█")
  65.         gpu.setForeground(0x0033cc)
  66.         gpu.set(x1,y1, "█")
  67.         gpu.setForeground(0x4d79ff)
  68.         gpu.set(x2,y2, "█")
  69.         gpu.set(x2+4,y2+5, " ")
  70.         gpu.setForeground(0x002080)
  71.         gpu.set(x2+2,y2+1, "█")
  72.         gpu.setForeground(0x002699)
  73.         end
  74.     end
  75.     if input == "d" then
  76.         while true do
  77.         os.sleep(0)
  78.         local x = math.random(0, 160)
  79.         local y = math.random(0, 80)
  80.         local x1 = x + math.random(0,10)
  81.         local y1 = y + math.random(1,5)
  82.         local x2 = x + math.random(1,8)
  83.         local y2 = y + math.random(2,5)
  84.         gpu.set(x,y, "█")
  85.         gpu.setForeground(0x33cc33)
  86.         gpu.set(x1,y1, "█")
  87.         gpu.setForeground(0x196619)
  88.         gpu.set(x2,y2, "█")
  89.         gpu.set(x2+4,y2+5, " ")
  90.         gpu.setForeground(0xadebad)
  91.         gpu.set(x2+2,y2+1, "█")
  92.         gpu.setForeground(0x47d147)
  93.      end
  94.      end
  95. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement