Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- local inv = sensor.wrap("top")
- rednet.open("back")
- function loadTable()
- file = fs.open("invLocs.txt", "r")
- invIDs = { }
- if file then
- for line in file.readLine do
- local ID, loc = string.match(line, "(%w+)%s=%s(%S+)")
- invIDs[ID] = loc
- end
- end
- file.close()
- end
- function getCount(tabID)
- print(tabID)
- foo = tostring(tabID)
- tabInv = inv.getTargets()[foo]
- invCount = tabInv["ItemCount"]
- return invCount
- end
- function sendBones()
- boneCount = getCount(invIDs["inv01"])
- rednet.send(25, boneCount)
- end
- loadTable()
- while true do
- sendBones()
- print("Bones = " .. boneCount)
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment