Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Inventory and Peripheral Program
- -- For use with computercraft and OpenPeripherals, to display Inventory information on both items and
- -- fluids.
- -- Programmed By Linrox
- -- Requirements: 1x Advanced Computer (GOLD) and 40x Advanced Monitors (5 heigh x 8 wide)
- -- SETUP VARIABLES
- local w, s, tp, ID, txt, timeout,modSd,monSd,bc
- local MyID, MyName, wm, hm, DevName
- monFound=False
- -- Table Variables
- term.clear()
- term.setCursorPos(1,1)
- --TABLES
- local DeviceNames={}
- function ComputerInfo()
- MyID= (os.getComputerID())
- MyName=(os.getComputerLabel())
- end
- ComputerInfo()
- function MonitorInfo()
- if monFound==false then print("Monitor not found")
- DevAsk()
- else wm, hm = monitor.getSize()
- end
- end
- function checkExtra(DevName,currD)
- UDevType=peripheral.getType(DevName)
- if UDevType=="monitor" then
- mon=peripheral.wrap(DevName)
- if peripheral.isPresent(DevName) then
- print("Remote "..DevName.." Found ",currD)
- print("Give a user friendly name to use for "..DevName)
- newDevName=io.read()
- DeviceNames[tonumber(currD)]=tostring(newDevName)
- for k,v in pairs(DeviceNames) do
- if tostring(v)==newDevName then
- print(tostring(v).." has been added, using key "..k)
- end
- end
- mfsu=peripheral.wrap(DevName)
- print(newDevName.." Assigned")
- end
- end
- if UDevType=="mfsu" then
- if peripheral.isPresent(DevName) then
- print("Remote "..DevName.." Found")
- print("Give a user friendly name to use for "..DevName)
- newDevName=io.read()
- DeviceNames[tonumber(currD)]=tostring(newDevName)
- for k,v in pairs(DeviceNames) do
- if tostring(v)==newDevName then
- print(tostring(v).." has been added, using key "..k)
- end
- end
- print(newDevName,DevName)
- newDevName=peripheral.wrap(DevName)
- print(newDevName.." Assigned")
- end
- end
- if UDevType=="net_minecraft_src_buildcraft_factory_tiletank_0" then
- if peripheral.isPresent(DevName) then
- bctank=peripheral.wrap(DevName)
- print("Remote "..DevName.." Found")
- print("Give a user friendly name to use for "..DevName)
- newDevName=io.read()
- DeviceNames[tonumber(currD)]=tostring(newDevName)
- for k,v in pairs(DeviceNames) do
- if tostring(v)==newDevName then
- print(tostring(v).." has been added, using key "..k)
- end
- end
- newDevName=peripheral.wrap(DevName)
- print(newDevName.." Assigned")
- end
- end
- if UDevType=="rcirontankvalvetile" then
- if peripheral.isPresent(DevName) then
- irontank=peripheral.wrap(DevName)
- print("Remote "..DevName.." Found")
- print("Give a user friendly name to use for "..DevName)
- newDevName=io.read()
- DeviceNames[tonumber(currD)]=tostring(newDevName)
- for k,v in pairs(DeviceNames) do
- if tostring(v)==newDevName then
- print(tostring(v).." has been added, using key "..k)
- end
- end
- mfsu=peripheral.wrap(DevName)
- print(newDevName.." Assigned")
- end
- end
- if UDevType=="cofh_thermalexpansion_energycell" then
- if peripheral.isPresent(DevName) then
- cell=peripheral.wrap(DevName)
- print("Remote "..DevName.." Found")
- print("Give a user friendly name to use for "..DevName)
- newDevName=io.read()
- DeviceNames[tonumber(currD)]=tostring(newDevName)
- for k,v in pairs(DeviceNames) do
- if tostring(v)==newDevName then
- print(tostring(v).." has been added, using key "..k)
- end
- end
- mfsu=peripheral.wrap(DevName)
- print(newDevName.." Assigned")
- end
- end
- if UDevType=="appeng_me_tileterminal" then
- if peripheral.isPresent(DevName) then
- meterminal=peripheral.wrap(DevName)
- print("Remote "..DevName.." Found")
- print("Give a user friendly name to use for "..DevName)
- newDevName=io.read()
- DeviceNames[tonumber(currD)]=tostring(newDevName)
- for k,v in pairs(DeviceNames) do
- if tostring(v)==newDevName then
- print(tostring(v).." has been added, using key "..k)
- end
- end
- newDevName=peripheral.wrap(DevName)
- print(newDevName.." Assigned")
- end
- end
- end
- function getDevName()
- print("How many devices?")
- local Devs=io.read()
- for currD=1,Devs do
- print("What is the Name of the device?")
- DevName=io.read()
- checkExtra(DevName,currD)
- end
- end
- function DevAsk()
- print("Is there another device? Y/N")
- Answer=io.read()
- if Answer=="Y" or Answer=="y" then getDevName()
- else print("ok")
- end
- end
- function findDev()
- print("ID: "..MyID.." Name: "..MyName)
- print("____________________________")
- for w = 1 , 5, 1 do --CHANGE THE 4 BACK TO 5
- if (w==1) then s="left" end
- if (w==2) then s="right" end
- if (w==3) then s="top" end
- if (w==4) then s="back" end
- if (w==5) then s="bottom" end
- ps=peripheral.isPresent(s)
- if (ps== true) then
- tp=peripheral.getType(s)
- --print("True found - w: ",w," s: ",s," tp: ",tp )
- if (tp=="modem") then
- Comms= peripheral.wrap(s)
- --[[for i,v in ipairs(peripheral.getMethods(s)) do
- print(i..". "..v) ]]--
- if Comms.isWireless() == true then
- print("Wireless Modem Found - Side: ",s)
- Wireless=peripheral.wrap(s)
- modSd=s
- else
- print("Modem Found - Side: ",s)
- Wired=peripheral.wrap(s)
- modSd=s
- end
- --end
- -- print("Device: "..tp)
- -- for i,v in ipairs(peripheral.getMethods(modSd)) do
- -- print(i..". "..v)
- -- end
- end
- if (tp=="monitor") then
- if monFound==false then print("Monitor not found")
- DevAsk()
- --[[for i,v in ipairs(peripheral.getMethods(s)) do
- --print(i..". "..v)]]--
- monitor= peripheral.wrap(s)
- print("Monitor Found - Side: ",s )
- local monSd=s
- monFound=True
- --MonitorInfo()
- print("Monitor Height:"..hm.." Width:"..wm)
- end
- end
- --if w=="4" then
- --local BackProxy=tp
- --bproxy=peripheral.wrap(modSd)
- -- if BackProxy=="container_chest" then
- -- for i,v in ipairs(bproxy) do
- -- print(i..". "..v)
- --end
- --print(tp.." is Found on the "..s)
- --end
- end
- end
- end
- findDev()
- DevAsk()
Advertisement
Add Comment
Please, Sign In to add comment