Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArg = {...}
- local digitizer = peripheral.find("item_digitizer")
- function Digitize()
- local itemID = digitizer.digitize()
- local file = fs.open("ItemList","a")
- file.writeLine(itemID)
- file.close()
- end
- function Physic(item)
- local Content
- local file = fs.open("ItemList","a")
- local Found = false
- repeat
- Content = file.readLine()
- if Found == false and Content ~= "empty" then
- local Item = digitizer.dataID(Content)
- if Item.displayName == item then
- Found = true
- digitizer.rematerialize(Content)
- file.ClearLine()
- file.writeLine("empty")
- end
- end
- until Content == nil
- file.close()
- return Found
- end
- function ListItems()
- term.clear()
- term.setCursorPos(1,1)
- local file = fs.open("ItemList","r")
- local Contents
- repeat
- Contents = file.readLine()
- print(Contents)
- until Contents == nil
- end
- if tArg[1] == "Dig" then
- Digitize()
- elseif tArg[1] == "List" then
- ListItems()
- elseif tArg[1] == "Phy" then
- print("item found? ",Physic(tArg[2]))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement