Advertisement
Guest User

prog

a guest
Nov 26th, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.66 KB | None | 0 0
  1. mon = peripheral.wrap("back")
  2. mon.setTextScale(2)
  3. mon.setBackgroundColor(colors.black)
  4. mon.setCursorPos(1,1)
  5. mon.clear()
  6. local businessName = "Cruck's Computers"
  7. local w, h = mon.getSize()
  8. center = math.floor(w/2 + (string.len(businessName)/1.5))-string.len(businessName)-2
  9. function linesIn()
  10.   mon.setBackgroundColor(colors.black)
  11.   mon.setTextColor(colors.white)
  12.   mon.clear()
  13.   for wid = 1, w do
  14.     for lin = 1, h do
  15.       if lin % 2 == 0 then
  16.         mon.setBackgroundColor(colors.gray)
  17.         if lin == math.floor(h/2) then
  18.           if wid < math.floor(w/2 + (string.len(businessName)/1.5))-1 then
  19.             mon.setCursorPos(wid-string.len(businessName)-1, lin)
  20.             mon.write(" "..businessName)
  21.           end
  22.         end
  23.         mon.setCursorPos(wid, lin)
  24.       else
  25.         mon.setBackgroundColor(colors.lightGray)
  26.         mon.setCursorPos(w-wid+1,lin)
  27.       end
  28.       mon.write(" ")
  29.     end
  30.     sleep(0.075)
  31.   end
  32. end
  33. function flashLines()
  34.   mon.setBackgroundColor(colors.black)
  35.   mon.setTextColor(colors.white)
  36.   mon.clear()
  37.   for i = 1, 15 do
  38.     for lin = 1, h do
  39.       if (i + lin) % 2 == 0 then
  40.         mon.setBackgroundColor(colors.gray)
  41.       else
  42.         mon.setBackgroundColor(colors.lightGray)
  43.       end
  44.       mon.setCursorPos(1,lin)
  45.       mon.clearLine()
  46.       if lin == math.floor(h/2) then
  47.         mon.setCursorPos(center, lin)
  48.         mon.write(businessName)
  49.       end
  50.     end
  51.     sleep(0.5)
  52.   end
  53. end
  54. function lineCycle()
  55.   linesIn()
  56.   flashLines()
  57.   sleep(10)
  58. end
  59. function unscramble()
  60.   mon.setBackgroundColor(colors.black)
  61.   mon.setTextColor(colors.white)
  62.   mon.clear()
  63.   dat = {}
  64.   temp = {}
  65.   for i = 1, string.len(businessName) do
  66.     dat[i] = string.sub(businessName, i, i)
  67.     temp[i] = string.sub(businessName, i, i)
  68.   end
  69.   for i = 1, #temp do
  70.     temp[i] = tostring(math.random(1,9))
  71.   end
  72.  
  73.   mon.setCursorPos(center,math.floor(h/2))
  74.   mon.write(table.concat(temp))
  75.  
  76.   for i = 1, #dat do
  77.     for j = 1, 5 do
  78.       temp[i] = tostring(math.random(1,9))
  79.       mon.setCursorPos(center+i-1,math.floor(h/2))
  80.       mon.write(temp[i])
  81.       sleep(0.05)
  82.     end
  83.     temp[i] = dat[i]
  84.     mon.setCursorPos(center+i-1,math.floor(h/2))
  85.     mon.write(temp[i])
  86.   end
  87.   sleep(20)
  88. end
  89. function randomDots()
  90.   mon.setBackgroundColor(colors.black)
  91.   mon.setTextColor(colors.white)
  92.   mon.clear()
  93.   for i = 1, 50 do
  94.     x = math.random(2, w-1)
  95.     y = math.random(2, h-1)
  96.    
  97.     color = nil
  98.     while color == nil or color == colors.gray or color == colors.brown do
  99.       color = 1*2^math.random(0, 15)
  100.     end
  101.     mon.setBackgroundColor(color)
  102.    
  103.     mon.setCursorPos(x,y)
  104.     mon.write(" ")
  105.     mon.setCursorPos(x-1, y)
  106.     mon.write(" ")
  107.     mon.setCursorPos(x, y+1)
  108.     mon.write(" ")
  109.     mon.setCursorPos(x, y-1)
  110.     mon.write(" ")
  111.     mon.setCursorPos(x+1, y)
  112.     mon.write(" ")
  113.     sleep(0.1)
  114.   end
  115.   mon.setBackgroundColor(colors.black)
  116.   mon.setCursorPos(center, h/2)
  117.   mon.write(businessName)
  118.   sleep(10)
  119. end
  120. function arrowDown()
  121.   mon.setBackgroundColor(colors.black)
  122.   mon.setTextColor(colors.yellow)
  123.   mon.clear()
  124.   term.redirect(mon)
  125.   arr = paintutils.loadImage("arrow")
  126.   for i = 1, 40 do
  127.     pos = 0
  128.     if i % 4 ~= 0 then
  129.       pos = i%4
  130.     else
  131.       pos = 2
  132.     end
  133.     term.setBackgroundColor(colors.black)
  134.     term.clear()
  135.     paintutils.drawImage(arr, 1, pos+3)
  136.     term.setBackgroundColor(colors.black)
  137.     term.setCursorPos(center, pos+2)
  138.     term.write(businessName)
  139.     sleep(0.5)
  140.   end
  141.   term.redirect(term.native())
  142.   sleep(1)
  143. end
  144. comms = {lineCycle, unscramble, randomDots, arrowDown}
  145.  
  146. while true do
  147.   comms[math.random(1,#comms)]()
  148. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement