Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this is a standardized program for all Computer units that require the use of Digital items
- local tArg = {...}
- local HostName = tArg[3]
- local Mode = tArg[2]
- local Item = tArg[1]
- function Interact()
- local Modem = peripheral.find("Modem")
- rednet.open()
- local id = rednet.lookup(6700,"AP_IT_Storage")
- local Serverid = id
- if mode == "Request" then
- rednet.send(Serverid,"Request",6700)
- repeat
- local id, message = rednet.receive()
- until id == Serverid and message == "Send"
- rednet.send(Serverid,Item,6700)
- repeat
- local id, message = rednet.receive()
- until id == Serverid
- local file = fs.open("StoredItems","a")
- local i = 0
- while file.readLine()
- i = i+1
- end
- file.setCursorPos(1,i)
- file.writeLine(message)
- file.close()
- elseif Mode == "Send" then
- rednet.send(Serverid,"Send",6700)
- repeat
- local id, message = rednet.receive()
- until id == Serverid and message == "Send"
- rednet.send(Serverid,Item,6700)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement