daily pastebin goal
40%
SHARE
TWEET

dlTelenet

a guest Mar 23rd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  8. term.clear()
  9.  
  10.  
  11. print("StormWolf's TeleNet selector client")
  12.  
  13. function client ()
  14.   inventory = { }
  15.   inventory = inventoryScanner()
  16.  
  17.   term.setCursor(1,4)
  18.  
  19.   --i is starting position for inventory scanner
  20.   i=1
  21.   position=4
  22.   while tostring(inventory[i]) ~= nil do
  23.    
  24.     io.write("["..i.."] - "..inventory[i])
  25.     term.setCursor(1,position)
  26.     position = position+1
  27.     end
  28.  
  29.   position = position+1
  30.   term.setCursor(1, position)
  31.   io.write("--------------------------------------------------")
  32.   position=position+1
  33.  
  34.  
  35.   while true do
  36.     term.setCursor(1, position)
  37.     io.write("Input number for desired location followed by enter: ")
  38.     term.setCursor(1, position+1)
  39.     location = io.read()
  40.     invAccess.transferItem(sides.right, sides.top, 1, location, 1)
  41.     end
  42.   end
  43.  
  44.  
  45. function inventoryScanner()
  46.   local size, err = chestAccess.getInventorySize(sides.top)
  47.   if not size then -- if size is nil
  48.     error(err) -- end the program and print the error that
  49.     -- getInventorySize returned.
  50.   end
  51.   for i = 1, size do
  52.     if not item then break end
  53.       local item = chestAccess.getStackInSlot(sides.top, i)
  54.       inventory[i] = item.label
  55.       io.write(tostring(inventory[i]))
  56.     end
  57.   return inventory
  58. end
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. --actual shit thats executed at instant run:
  66. client()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top