themadgod

boot

Oct 1st, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. local mon = peripheral.wrap("left")
  2. local ae = peripheral.wrap("back")
  3.  
  4. local items = {
  5. cobble = {4, 0, colors.gray},
  6. stone = {1, 0, colors.lightGray},
  7. sbricks = {980, 0, colors.lightGray},
  8. sand = {12, 0, colors.yellow},
  9. glass = {20, 0, colors.white},
  10. obsdian = {49, 0, colors.purple},
  11. iron = {265, 0 , colors.lightGray},
  12. redst = {331, 0, colors.red},
  13. gold = {266, 0, colors.yellow},
  14. diam = {264, 0, colors.cyan},
  15. quartz = {5758, 8, colors.lightBlue},
  16. uranium = {18006, 0 , colors.lime},
  17. tin = {8883, 64 , colors.white},
  18. copper = {8883, 63 , colors.orange},
  19. }
  20.  
  21.  
  22. function draw(t)
  23. mon = peripheral.wrap("left")
  24. mon.setTextScale(0.5)
  25. term.setCursorPos(1,1)
  26. hmargin = 0
  27. vmargin = 0
  28. x = 1
  29. y = 1
  30. i=0
  31. for k,v in pairs(t) do
  32.  
  33. paint(v[3])
  34. term.setCursorPos(x,y)
  35. print(k..":")
  36. paint(1)
  37. term.setCursorPos(x+9, y)
  38. print(ae.countOfItemType(v[1],v[2]))
  39.  
  40. y = y+1
  41. if i % 8 == 0 and i ~= 0 then
  42. x = x + 14
  43. y = 0
  44. end
  45.  
  46. i = i + 1
  47. end
  48.  
  49. term.setCursorPos(34, 3)
  50. print(">")
  51. term.setCursorPos(34, 7)
  52. print("<")
  53.  
  54. os.sleep(5)
  55. mon.clear()
  56. end
  57.  
  58. page = 0
  59.  
  60. function getPage(page)
  61. thisPage{}
  62. for idx = page*16, idx+16, 1 do
  63. if items[idx] then
  64. table.insert(items[idx], thisPage)
  65. end
  66. end
  67. return thisPage
  68. end
  69.  
  70. while true do
  71.  
  72. p = getPage(page)
  73. draw(p)
  74.  
  75. os.queueEvent("")
  76. evt, btn, x, y = os.pullEvent("mouse_click")
  77. if evt and x > 32 and y < 5 then
  78. page = page + 1
  79. elseif evt and x > 32 and y > 5 and page > 0 then
  80. page = page - 1
  81. end
  82.  
  83.  
  84. function paint(color)
  85. if color ~= nil then
  86. mon.setTextColor(color)
  87. else
  88. mon.setTextColor(colors.white)
  89. end
  90. end
Add Comment
Please, Sign In to add comment