Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- do
- component = require("component")
- term = require("term")
- table = require("table")
- chestapi = require("ChestAPI")
- computer = component.computer
- rs = component.redstone
- gpu = component.gpu
- gpu.setResolution(80,25)
- --made by StormWolf (AKA StormCircuit) with help from chummy
- version=00.9
- term.clear()
- print("StormCircuit's TeleNet selector client version "..tostring(version))
- print("\n---------------------------------------------------------------------")
- function client ()
- do
- initialize()
- inventory = { }
- inventory = inventoryScanner(0)
- --i is starting position for inventory scanner
- i=1
- while i<=15 do
- term.setCursor(1,i+3)
- term.clearLine()
- if not inventory[i] then
- io.write("["..i.."] - No input")
- else
- io.write("["..i.."] - "..tostring(inventory[i]))
- end
- i=i+1
- end
- j=1
- while i<=30 do
- term.setCursor(40,j+3)
- if not inventory[i] then
- io.write("["..i.."] - No input")
- else
- io.write("["..i.."] - "..tostring(inventory[i]))
- end
- i=i+1
- j=j+1
- end
- print("\n-------------------------------------------------------------------")
- cursorPosition=20
- prevlocation=1
- while true do
- term.setCursor(1,cursorPosition)
- term.clearLine()
- io.write("Input number for desired location followed by enter: ")
- location = io.read()
- location = tonumber(location)
- if not tonumber(location) then
- term.clearLine()
- print("Invalid option. Please try again.")
- client()
- elseif not inventory[location] then
- term.clearLine()
- print("Invalid option. Please try again.")
- client()
- elseif tonumber(location)==-1 then
- term.clearLine()
- print("Reloaded table.")
- client()
- elseif tonumber(location)<0 then
- term.clearLine()
- print("Invalid option. Please try again.")
- client()
- elseif tonumber(location)>0 then
- location = tonumber(location)
- else
- end
- --transfer item here
- transposer.transferItem(0, 1, 1, location, 1)
- i=0
- while i<2 do
- term.setCursor(1,cursorPosition+2)
- term.clearLine()
- io.write("Loading location... {}")
- os.sleep(0.5)
- term.setCursor(1,cursorPosition+2)
- io.write("Loading location... { }")
- computer.beep()
- os.sleep(0.5)
- term.clearLine()
- i=i+1
- term.setCursor(1,2)
- term.clearLine()
- if location then
- io.write("Last location entered: "..inventory[location])
- end
- end
- term.setCursor(1,cursorPosition+1)
- term.clearLine()
- term.setCursor(1,cursorPosition+3)
- io.write("Initializing teleportation!")
- computer.beep()
- rs.setOutput(0, 10)
- rs.setOutput(0, 0)
- os.sleep(2)
- term.clearLine()
- prevlocation = location
- end
- end
- end
- --Old functions - left here while code is being refactored to use ChestAPI
- function inventoryScanner()
- local sides = require("sides")
- size = chestAccess.getInventorySize(sides.top)
- i = 1
- while i<size do
- item = chestAccess.getStackInSlot(sides.top, i)
- if not item then break end
- inventory[i] = tostring(item.label)
- i=i+1
- end
- return inventory
- end
- --actual shit thats executed at instant run:
- client()
- end
Add Comment
Please, Sign In to add comment