tjaccardi

TeleNet0_2

Mar 26th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.18 KB | None | 0 0
  1. component = require("component")
  2. term = require("term")
  3. table = require("table")
  4. sides = require("sides")
  5. chestAccess = component.inventory_controller
  6. invAccess = component.transposer
  7. rs = component.redstone
  8.  
  9.  
  10.  
  11. gpu = component.gpu
  12. gpu.setResolution(80,25)
  13.  
  14. --made by StormWolf, for any non-profit use only
  15.  
  16. version =  00.2
  17.  
  18. term.clear()
  19.  
  20.  
  21. print("StormWolf's TeleNet selector client version "..version)
  22. print("\n--------------------------------------")
  23. function client ()
  24.  
  25.   inventory = { }
  26.   inventory = inventoryScanner()
  27.  
  28.   --i is starting position for inventory scanner
  29.   i=1
  30.   while i <= 15 do
  31.     term.setCursor(1,i+3)
  32.     term.clearLine()
  33.     print("["..i.."] - "..tostring(inventory[i]))
  34.     i=i+1
  35.     end
  36.   print("--------------------------------------------------")
  37.  
  38.  
  39.   while true do
  40.     term.setCursor(1,19)
  41.     print("Input number for desired location followed by enter")
  42.     term.clearLine()
  43.     io.write("or enter anything else to select last location list: ")
  44.     location = io.read()
  45.     if location == -1 then client() end
  46.     else if not location then end
  47.     else location = tonumber(location)
  48.     invAccess.transferItem(sides.bottom, sides.top, 1, location, 1)
  49.     i=0
  50.     while i<2 do
  51.       term.setCursor(1,21)
  52.       io.write("Loading location... {}")
  53.       os.sleep(0.5)
  54.       term.setCursor(1,21)
  55.       io.write("Loading location... { }")
  56.       os.sleep(0.5)
  57.       term.clearLine()
  58.       i=i+1
  59.       term.setCursor(1,2)
  60.       if location then
  61.         io.write("Last location entered: "..inventory[location])
  62.         end
  63.       end
  64.     term.setCursor(1,23)
  65.     term.clearLine()
  66.     term.setCursor(1,24)
  67.     io.write("Initializing teleportation!")
  68.     rs.setOutput(sides.bottom, 10)
  69.     rs.setOutput(sides.bottom, 0)
  70.     os.sleep(2)
  71.     term.clearLine()
  72.     end  
  73.   end
  74.  
  75.  
  76. function inventoryScanner()
  77.   size = chestAccess.getInventorySize(sides.top)
  78.   i = 1
  79.   while i<size do
  80.       item = chestAccess.getStackInSlot(sides.top, i)
  81.       if not item then break end
  82.       inventory[i] = tostring(item.label)
  83.       i=i+1
  84.     end
  85.   return inventory
  86. end
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. --actual shit thats executed at instant run:
  94. client()
Add Comment
Please, Sign In to add comment