Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- inventorySensor = sensor.wrap("top")
- fullTabletsKey = "0,-1,-2"
- emptyTabletsKey = "0,-1,-4"
- function countContent(inventoryKey)
- local sensorReading = {}
- sensorReading = inventorySensor.getTargetDetails(inventoryKey)
- --print(textutils.serialize(sensorReading))
- local content = 0
- content = sensorReading["ItemCount"]
- return content
- end
- while true do
- print("full tablets: " ..countContent(fullTabletsKey))
- print("empty tablets: " ..countContent(emptyTabletsKey))
- sleep(30)
- end
Advertisement
Add Comment
Please, Sign In to add comment