Advertisement
Guest User

test

a guest
Jul 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | None | 0 0
  1. rs.setAnalogOutput("bottom",15)
  2.  
  3. monitor       = peripheral.find("monitor")
  4. chest         = peripheral.find("chest")
  5. destinations  = {}
  6. cursorPosNull = {["x"] = 2, ["y"] = 2}
  7. clickX        = 0
  8. clickY        = 0
  9. row           = 0
  10. rows          = {}
  11.  
  12. function Clear()
  13.   monitor.clear()
  14.   monitor.setCursorPos(cursorPosNull["y"],cursorPosNull["x"])
  15. end
  16.  
  17. function ListDestinations()
  18.   for slot = 1,chest.getInventorySize() do
  19.     stack = chest.getStackInSlot(slot)
  20.     if not stack then
  21.       chest.pullItem("east",1,1,slot)
  22.       stack = chest.getStackInSlot(slot)
  23.     end
  24.     if stack then
  25.       destinations[slot] = stack.display_name
  26.     end
  27.   end
  28.  
  29.   rows = {}
  30.   for slot, destination in pairs(destinations) do
  31.     print(slot.." -> "..destination)
  32.     x, y = monitor.getCursorPos()
  33.     monitor.write(slot.." -> "..destination)
  34.     monitor.setCursorPos(x, y+1)
  35.     x, y = monitor.getCursorPos()
  36.     rows[x]=slot
  37.   end
  38. end
  39.  
  40. function GetClick()
  41.   local event
  42.   local side
  43.   local x
  44.   local y
  45.   event, side, x, y = os.pullEvent("monitor_touch")
  46.   return x, y
  47. end
  48.  
  49. Clear()
  50. ListDestinations()
  51. --clickX, clickY = GetClick()
  52.  
  53. for key, value in pairs(rows) do
  54.   print(key.." - "..value)
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement