IronClaymore

[minecraft-CC] basic scrolling text

Jul 21st, 2014
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.13 KB | None | 0 0
  1. local looptime = 0.5
  2.  
  3. function getDeviceSide(deviceType)
  4.         deviceType = deviceType:lower()
  5.    
  6.         for i, side in pairs(rs.getSides()) do
  7.                 if (peripheral.isPresent(side)) then
  8.                         if (string.lower(peripheral.getType(side)) == deviceType) then
  9.                                 return side;
  10.                         end
  11.                 end
  12.         end
  13.    
  14.         return nil;
  15. end
  16.  
  17. function wrapThis(thing, f)
  18.         local wrapped = nil
  19.         while wrapped == nil and f <= 100 do
  20.                 wrapped = peripheral.wrap(thing.."_"..f)
  21.                 f = f + 1
  22.         end
  23.  
  24.         if wrapped == nil then
  25.                 side = getDeviceSide(thing)
  26.                 if side ~= nil then
  27.                         return peripheral.wrap(side)
  28.                 else
  29.                         return nil
  30.                 end
  31.         else
  32.                 return wrapped
  33.         end
  34. end
  35.  
  36. local monitor = wrapThis("monitor", 0)
  37. monitor.setTextScale(1.5)
  38. monitor.setTextColor(colors.magenta)
  39.  
  40. if monitor == nil then
  41.         print("Can't find monitor.")
  42.         sleep(5)
  43.         finished = true
  44.         os.reboot()
  45. end
  46.  
  47. if  monitor then
  48.         term.clear()
  49.         term.setCursorPos(1,1)
  50.         term.write("Display redirected to Monitor. CTRL+T to exit.")
  51. end
  52.  
  53. while not finished do
  54.     monitor.clear()
  55.     monitor.setCursorPos(1,2)
  56.     monitor.write("CAFETERIA         ")
  57.     sleep(looptime)
  58.     monitor.clear()
  59.     monitor.setCursorPos(1,2)
  60.     monitor.write("AFETERIA         C")
  61.     sleep(looptime)
  62.     monitor.clear()
  63.     monitor.setCursorPos(1,2)
  64.     monitor.write("FETERIA         CA")
  65.     sleep(looptime)
  66.     monitor.clear()
  67.     monitor.setCursorPos(1,2)
  68.     monitor.write("ETERIA         CAF")
  69.     sleep(looptime)
  70.     monitor.clear()
  71.     monitor.setCursorPos(1,2)
  72.     monitor.write("TERIA         CAFE")
  73.     sleep(looptime)
  74.     monitor.clear()
  75.     monitor.setCursorPos(1,2)
  76.     monitor.write("ERIA         CAFET")
  77.     sleep(looptime)
  78.     monitor.clear()
  79.     monitor.setCursorPos(1,2)
  80.     monitor.write("RIA         CAFETE")
  81.     sleep(looptime)
  82.     monitor.clear()
  83.     monitor.setCursorPos(1,2)
  84.     monitor.write("IA         CAFETER")
  85.     sleep(looptime)
  86.     monitor.clear()
  87.     monitor.setCursorPos(1,2)
  88.     monitor.write("A         CAFETERI")
  89.     sleep(looptime)
  90.     monitor.clear()
  91.     monitor.setCursorPos(1,2)
  92.     monitor.write("         CAFETERIA")
  93.     sleep(looptime)
  94.     monitor.clear()
  95.     monitor.setCursorPos(1,2)
  96.     monitor.write("        CAFETERIA ")
  97.     sleep(looptime)
  98.     monitor.clear()
  99.     monitor.setCursorPos(1,2)
  100.     monitor.write("       CAFETERIA  ")
  101.     sleep(looptime)
  102.     monitor.clear()
  103.     monitor.setCursorPos(1,2)
  104.     monitor.write("      CAFETERIA   ")
  105.     sleep(looptime)
  106.     monitor.clear()
  107.     monitor.setCursorPos(1,2)
  108.     monitor.write("     CAFETERIA    ")
  109.     sleep(10)
  110.     monitor.clear()
  111.     monitor.setCursorPos(1,2)
  112.     monitor.write("    CAFETERIA     ")
  113.     sleep(looptime)
  114.     monitor.clear()
  115.     monitor.setCursorPos(1,2)
  116.     monitor.write("   CAFETERIA      ")
  117.     sleep(looptime)
  118.     monitor.clear()
  119.     monitor.setCursorPos(1,2)
  120.     monitor.write("  CAFETERIA       ")
  121.     sleep(looptime)
  122.     monitor.clear()
  123.     monitor.setCursorPos(1,2)
  124.     monitor.write(" CAFETERIA        ")
  125.     sleep(looptime)
  126. end
Advertisement
Add Comment
Please, Sign In to add comment