tuekats

tabletStorage

Nov 22nd, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2. inventorySensor = sensor.wrap("top")
  3.  
  4. fullTabletsKey = "0,-1,-2"
  5. emptyTabletsKey = "0,-1,-4"
  6.  
  7. function countContent(inventoryKey)
  8.     local sensorReading = {}
  9.     sensorReading = inventorySensor.getTargetDetails(inventoryKey)  
  10.     --print(textutils.serialize(sensorReading))
  11.     local content = 0
  12.     content = sensorReading["ItemCount"]
  13.     return content
  14. end
  15.  
  16. while true do
  17.     print("full tablets: " ..countContent(fullTabletsKey))
  18.     print("empty tablets: " ..countContent(emptyTabletsKey))
  19.     sleep(30)
  20. end
Advertisement
Add Comment
Please, Sign In to add comment