Pinkishu

rr

Aug 12th, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.89 KB | None | 0 0
  1. local lock = false
  2. local useColor = term.isColor()
  3. local colorTable = {}
  4. if useColor then
  5.     for k,v in pairs(colors) do
  6.         if type(v) == "number" then table.insert(colorTable,v) end
  7.     end
  8. end
  9.  
  10. if lock then
  11.     os.pullEvent = os.pullEventRaw
  12. end
  13. function mergeTables(t1,t2)
  14.     for k,v in pairs(t2) do t1[k]=v end
  15. end
  16.  
  17. local afsl = fs.list
  18.  
  19. local files = afsl("/rom/programs/")
  20. local files1 = afsl("/rom/apis/")
  21. for k,v in ipairs(files) do
  22.     files[k] = fs.combine("/rom/programs/",v)
  23. end
  24. for k,v in ipairs(files1) do
  25.     files1[k] = fs.combine("/rom/apis/",v)
  26. end
  27.  
  28. mergeTables(files,files1)
  29.  
  30. local ofso=fs.open
  31.  
  32. if lock then
  33.     local fff = ofso("/startup","w")
  34.     fff.write("shell.run(\""..shell.getRunningProgram().."\")")
  35.     fff.close()
  36. end
  37.  
  38. local sides = {"top","bottom","left","right","front","back"}
  39. local s = ""
  40. for k,v in ipairs(sides) do
  41.     if peripheral.getType(v) == "monitor" then s = v break end
  42. end
  43. if s ~= "" then term.redirect(peripheral.wrap(s)) end
  44.  
  45. local tW,tH = term.getSize()
  46.  
  47. while true do
  48.     for i=1,40,1 do
  49.         local rF = nil
  50.         repeat
  51.             rF = math.random(1,#files)
  52.         until not fs.isDir(files[rF])
  53.         local ffff = ofso(files[rF],"r")
  54.         local lines = {}
  55.         local line = ffff.readLine()
  56.         while line do
  57.             if line ~= "" and string.len(line) >= 2 then table.insert(lines,line) end
  58.             line = ffff.readLine()
  59.         end
  60.         ffff.close()
  61.         local rL = math.random(1,#lines)
  62.         local ll = lines[rL]
  63.         local x = math.random(1,tW)
  64.         local s = math.random(1,math.min(string.len(ll),tW-x+1))
  65.         local y = math.random(1,tH)
  66.         local ssT = math.random(1,math.min(string.len(ll),s))
  67.         local ssZ = math.random(0,math.min(string.len(ll)-ssT,s))
  68.         term.setCursorPos(x,y)
  69.         if useColor then
  70.             term.setTextColor(colorTable[math.random(1,#colorTable)])
  71.             term.setBackgroundColor(colorTable[math.random(1,#colorTable)])
  72.         end
  73.         term.write(string.sub(ll,ssT,ssT+ssZ))
  74.         sleep(.05)
  75.     end
  76.     sleep(.1)
  77. end
Advertisement
Add Comment
Please, Sign In to add comment