Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --rednet details
- rside = "left"
- rednet.open(rside)
- shopId = 20
- --Other info
- monitorSide = "top"
- term.redirect(peripheral.wrap(monitorSide))
- --empty container
- function emptyContainer()
- if shell.run("empty") then
- return true
- else
- return false
- end
- end
- --pull item
- function pullItem(itm)
- shell.run("pull "..itm)
- end
- function saleInfo(sa,sb)
- print("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
- print("Sold "..sa)
- print("Category "..sb)
- print("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
- end
- function packetInfo(ta,tb,tc)
- print("##############################")
- print("Found Packet:")
- print("ID: "..ta)
- print("Msg: "..tb)
- print("Cat: "..tc)
- print("##############################")
- end
- function errorReport(as,ab,ag)
- print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
- print("UNKNOWN ERROR: Info Known:")
- print("ID: "..as)
- print("Message: "..ab)
- print("Category: "..ag)
- print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
- end
- while true do
- id, msg, cat = rednet.receive()
- if id == shopId then
- if cat == "pull" then
- pullItem(msg)
- rednet.send(shopId,"1")
- sleep(.2)
- rednet.send(shopId,"2")
- --print sale
- saleInfo(msg,cat)
- elseif cat == "empty" then
- emptyContainer()
- else
- errorReport(id,msg,cat)
- end
- else
- packetInfo(id,msg,cat)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement