Advertisement
spongeyperson

Banned Item List text scroller

Aug 25th, 2012
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | None | 0 0
  1. local function pcenter(input)
  2. local size={term.getSize()}
  3. local pos={term.getCursorPos()}
  4. if input then
  5. term.setCursorPos(size[1]/2-string.len(input)/2,pos[2])
  6. write(input)
  7. else
  8. print("oops")
  9. print(pos[2])
  10. print(input)
  11. end
  12. end
  13.  
  14. local function scrollat(input,starty,endy,delay)
  15.  
  16. if not input then
  17. term.clear()
  18. term.setCursorPos(1,1)
  19. print("USAGE: scrollat(table-of-scrolling-values,y-value-at-which-the-nest-starts,y-value-at-which-the-nest-stops,the-time-in-seconds-between-each-scroll)")
  20. end
  21.  
  22. if type(input)~="table" then
  23. print("incorrect input")
  24. return nil
  25. end
  26.  
  27. delay=delay or 1
  28.  
  29. local scrolled=0
  30. while true do
  31. for y=starty,endy do
  32. term.setCursorPos(1,y)
  33. local current=y+scrolled-starty+1
  34. if current>#input then
  35. current=current-#input
  36. end
  37. local size={term.getSize()}
  38. for a=1,size[1]-1 do
  39. write(" ")
  40. end
  41. pcenter(input[current])
  42. end
  43. scrolled=scrolled+1
  44. if scrolled>#input then
  45. scrolled=1
  46. end
  47. sleep(delay)
  48. end
  49. end
  50.  
  51. local tBanned = {"Hyper Kinetic Lens", "Red Matter Furnace", "Computercraft", "Volcanite Amulet", "Black Hole Chest", "Mercurial Eye", "Black Hole Band", "Watch of Flowing Time", "Evertide Amulet", "Nova Catalyst", "Wireless Tracker", "Destruction Catalyst", "Wireless Transceiver", "Wireless Sniffer", "Wireless Remote", "Wireless Map", "World Anchor", "Rings Of Arcana", "Nova Cataclysm", "Gem Armor", "Void Ring", "Nukes, TNT, ITNT, Dynamite, Sticky Dynamite", "Alchemical Tome", "DarkMatter Pedestal", "Teleport Tether", "REP", "Mining Laser", "Crafting Bench 3", "All Energy Collectors","Block Breaker", "Terraformer","RM Tools & Armor", "DM Tools & Armor", "Philosopher's Stone"}
  52. term.clear()
  53. term.setCursorPos(1,1)
  54. pcenter("--Banned List--")
  55. local size={term.getSize()}
  56. scrollat(tBanned,3,size[2]-1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement