Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component = require("component")
- term = require("term")
- table = require("table")
- sides = require("sides")
- chestAccess = component.inventory_controller
- invAccess = component.transposer
- term.clear()
- print("StormWolf's TeleNet selector client")
- function client ()
- inventory = { }
- inventory = inventoryScanner()
- term.setCursor(1,4)
- --i is starting position for inventory scanner
- i=1
- position=4
- while tostring(inventory[i]) ~= nil do
- io.write("["..i.."] - "..inventory[i])
- term.setCursor(1,position)
- position = position+1
- end
- position = position+1
- term.setCursor(1, position)
- io.write("--------------------------------------------------")
- position=position+1
- while true do
- term.setCursor(1, position)
- io.write("Input number for desired location followed by enter: ")
- term.setCursor(1, position+1)
- location = io.read()
- invAccess.transferItem(sides.right, sides.top, 1, location, 1)
- end
- end
- function inventoryScanner()
- local size, err = chestAccess.getInventorySize(sides.top)
- if not size then -- if size is nil
- error(err) -- end the program and print the error that
- -- getInventorySize returned.
- end
- for i = 1, size do
- if not item then break end
- local item = chestAccess.getStackInSlot(sides.top, i)
- inventory[i] = item.label
- io.write(tostring(inventory[i]))
- end
- return inventory
- end
- --actual shit thats executed at instant run:
- client()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement