fishermedders

Don_Elevator_Code

May 13th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. m = peripheral.wrap("monitor_98")
  2. c = peripheral.wrap("top")
  3. --books = {{"Top Floor Volcano","Vanquished's House","MadMen4327's and Fog","GoofyCats' House","Nukelar's House","Rurede94"},{"MarketPlace","TheNamelessOnes","Dense","Archmaestro","FlynnPark1","Volcano Bottom Floor"},{"Rigg's House","_Aincrad_","keimarrag01"}}
  4. --names = {{"Volcano G-Level","Vanquished's Home","MadMen and Fog","GoofyCats' Home","Nukelar's Home","Rurede94 n friends"},{"CL Marketplace","TheNamelessOnes' Home","Dense Ores World","Archmaestro's Home","FlynnPark1's Home","Volcano BR-Level"},{"Rigg's Home","_Aincrad_'s Home","Keimarrag01"}}
  5. books = {{"Main Floor","Mt.Doom Central Hub","B1 Power","B2 Power","Deuterium Room","Evidence Room"},{"Book 2"}}
  6. names = {{"Main Floor","Mt.Doom Central Hub","B1 Power","B2 Power","Deuterium Room","Evidence Room"},{"Book 2 Name"}}
  7. xes = {}
  8. max = 6
  9. page = 1
  10. vc = colors.lime
  11.  
  12. function reset()
  13. term.setBackgroundColor(colors.white)
  14. term.setTextColor(colors.black)
  15. term.clear()
  16. end
  17.  
  18. function cprint(w,y,text)
  19. term.setCursorPos((w/2)-(#text/2),y)
  20. term.write(text)
  21. end
  22.  
  23. function getCenter(w,text,reset)
  24. if reset == false then
  25. one = (w/2)-(#text/2)
  26. two = one+#text
  27. tbl = {}
  28. table.insert(tbl,one)
  29. table.insert(tbl,two-1)
  30. table.insert(xes,tbl)
  31. elseif reset == true then
  32. xes = {}
  33. end
  34. end
  35.  
  36. for i = 1,c.getInventorySize() do
  37. if c.getStackInSlot(i) == nil then
  38. c.pullItem("south",1,1,i)
  39. break
  40. end
  41. end
  42.  
  43. while true do
  44. term.redirect(m)
  45. reset()
  46. term.setBackgroundColor(vc)
  47. term.setCursorPos(1,1)
  48. size = {term.getSize()} --term has already been redirected.
  49. for i = 1,size[1] do
  50. term.write(" ")
  51. end
  52. term.setCursorPos(1,size[2])
  53. for i = 1,size[1] do
  54. term.write(" ")
  55. end
  56. term.setCursorPos((size[1]/2)-4,size[2]-2)
  57. term.write(" < ")
  58. term.setCursorPos((size[1]/2)+1,size[2]-2)
  59. term.write(" > ")
  60. cprint(size[1],size[2],"by XMedders")
  61. cprint(size[1],1,"Tele Terminal")
  62. term.setBackgroundColor(colors.white)
  63. cprint(size[1],size[2]-1,"Page "..page)
  64. cprint(size[1],3,"Select a Destination")
  65. for i = 1,#books[page] do
  66. term.setBackgroundColor(vc)
  67. cpos = {term.getCursorPos()}
  68. cprint(size[1],cpos[2]+2," "..names[page][i].." ")
  69. getCenter(size[1]," "..names[page][i].." ",false)
  70. end
  71. term.restore()
  72. evnt = {os.pullEvent()}
  73. if evnt[1] == "monitor_touch" then
  74. for i = 1,#books[page] do
  75. if evnt[4] == 3+(2*i) then
  76. if evnt[3] >= xes[i][1] and evnt[3] <= xes[i][2] then
  77. print(names[page][i])
  78. stacks = c.getAllStacks()
  79. for ss = 1,#stacks do
  80. --print("test")
  81. if stacks[ss]["id"] == 6057 or stacks[ss]["id"] == 6058 then
  82. if stacks[ss]["destination"] == books[page][i] then
  83. c.pushItem("south",ss,1,1)
  84. sleep(3)
  85. c.pullItem("south",1,1,ss)
  86. end
  87. end
  88. end
  89. end
  90. end
  91. end
  92. if evnt[4] == size[2]-2 then
  93. if evnt[3] >= (size[1]/2)-5 and evnt[3] <= (size[1]/2)-2 then
  94. if page == 1 then
  95. page = #books
  96. else
  97. page = page-1
  98. end
  99. elseif evnt[3] >= (size[1]/2) and evnt[3] <= (size[1]/2)+3 then
  100. if page == #books then
  101. page = 1
  102. else
  103. page = page + 1
  104. end
  105. end
  106. end
  107. end
  108. getCenter(size[1],"na",true)
  109. end
Add Comment
Please, Sign In to add comment