Advertisement
LBPHacker

Messing with tables - for RustikGaming

Jun 6th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.41 KB | None | 0 0
  1.  -- Config --
  2. monSide = "right" -- Side the monitor is on relative to the computer --
  3. title = " -- DirePlayers -- " -- Title of the list --
  4. opstitle = " -- DireOP's -- " -- OP's Title --
  5. adminstitle = " -- DireAdmins -- " -- Admins Title --
  6. playerstitle = " -- DireMembers -- " -- Players Title --
  7. ops = {
  8.     "Zatharus28",
  9.     "MoparDan"
  10. }
  11. admins = {
  12.     "Drega1642",
  13.     "Tikaran"
  14. }
  15. players = {
  16.     "RustikGaming",
  17.     "Wolfpax181",
  18.     "AnotherPlatypus",
  19.     "Desexeh",
  20.     "Kibakichi",
  21.     "MaliceRoyal",
  22.     "RyuMarksmen",
  23.     "SoulLion",
  24.     "Malsvir_Sjach",
  25.     "TutorMC"
  26. }
  27.  -- Code --
  28.  -- mon = peripheral.wrap(monSide)
  29.  -- term.redirect( mon )
  30. local function pcenter(input)
  31.    
  32.     local size = {term.getSize()}
  33.     local pos = {term.getCursorPos()}
  34.     if input then
  35.         term.setCursorPos(size[1] / 2 - string.len(input) / 2, pos[2])
  36.         write(input)
  37.     end
  38. end
  39. local function scrollat(input, starty, endy, delay)
  40.     if not input then
  41.         term.clear()
  42.         term.setCursorPos(1, 1)
  43.         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)")
  44.     end
  45.     if type(input) ~= "table" then
  46.         print("incorrect input")
  47.         return nil
  48.     end
  49.     delay = delay or 1
  50.     local scrolled = 0
  51.     while true do
  52.         for y = starty, endy do
  53.             term.setCursorPos(1, y)
  54.             local current = y + scrolled - starty + 1
  55.             if current > #input then
  56.                 current = current - #input
  57.             end
  58.             local size = {term.getSize()}
  59.             for a = 1, size[1] - 1 do
  60.                 write(" ")
  61.             end
  62.             pcenter(input[current])
  63.         end
  64.         scrolled = scrolled + 1
  65.         if scrolled > #input then
  66.             scrolled = 1
  67.         end
  68.         sleep(delay)
  69.     end
  70. end
  71. local tBanned = {}
  72. table.insert(tBanned, opstitle)
  73. for i = 1, #ops do table.insert(tBanned, ops[i]) end
  74. table.insert(tBanned, " ")
  75. table.insert(tBanned, adminstitle)
  76. for i = 1, #admins do table.insert(tBanned, admins[i]) end
  77. table.insert(tBanned, " ")
  78. table.insert(tBanned, playerstitle)
  79. for i = 1, #players do table.insert(tBanned, players[i]) end
  80. table.insert(tBanned, " ")
  81. term.clear()
  82. term.setCursorPos(1, 1)
  83. pcenter(title)
  84. local size = {term.getSize()}
  85. scrollat(tBanned, 3, size[2] - 1, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement