Advertisement
Poppamunz

Blue and Poppa's Super Sign Program

Nov 17th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. mon = peripheral.find("monitor")
  2.  
  3. --Lines to display are in file "signtext" without quotes
  4. local file = io.open("signtext", "r")
  5. local text = {}
  6. local textlength = 0
  7. local j = 1
  8. while true do
  9.   line = file:read("*l")
  10.   if line == nil then break
  11.   else
  12.     text[j] = line
  13.     j = j + 1
  14.   end
  15. end
  16. file:close()
  17.  
  18. basePos = {mon.getSize()}
  19. local pos = {}
  20. for i=1,#text do
  21.   pos[i] = text[i]:len()
  22. end
  23.  
  24. function monwrite(color, x, y, text)
  25.   if mon.isColor() then mon.setTextColor(color) end
  26.   mon.setTextScale(2)
  27.   mon.setCursorPos(x, y)
  28.   mon.write(text)
  29. end
  30.  
  31. while true do
  32.   mon.clear()
  33.  
  34.   for i = 1,#text do
  35.     len = text[i]:len()
  36.       if pos[i]==-len then
  37.         pos[i] = len
  38.       end
  39.     monwrite(1024, pos[i], i, text[i])
  40.     pos[i] = pos[i] -1
  41.   end
  42.  
  43.   os.sleep(0.15)  
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement