SHOW:
|
|
- or go back to the newest paste.
| 1 | - | targetNumber = 100 |
| 1 | + | |
| 2 | inventorySensor = sensor.wrap("top")
| |
| 3 | ||
| 4 | - | chickenSensor = sensor.wrap("top")
|
| 4 | + | fullTabletsKey = "0,-1,-2" |
| 5 | emptyTabletsKey = "0,-1,-4" | |
| 6 | - | chickenCount = 0 |
| 6 | + | |
| 7 | function countContent(inventoryKey) | |
| 8 | - | function count() |
| 8 | + | local sensorReading = {}
|
| 9 | - | while true do |
| 9 | + | sensorReading = inventorySensor.getTargetDetails(inventoryKey) |
| 10 | - | local targets = chickenSensor.getTargets() |
| 10 | + | --print(textutils.serialize(sensorReading)) |
| 11 | - | --print(textutils.serialise(targets)) |
| 11 | + | local content = 0 |
| 12 | - | chickenCount = 0 |
| 12 | + | content = sensorReading["ItemCount"] |
| 13 | - | for key,value in pairs(targets) do |
| 13 | + | return content |
| 14 | - | chickenCount = chickenCount + 1 |
| 14 | + | |
| 15 | - | end |
| 15 | + | |
| 16 | - | for i=1,16 do |
| 16 | + | while true do |
| 17 | - | turtle.select(i) |
| 17 | + | print("full tablets: " ..countContent(fullTabletsKey))
|
| 18 | - | turtle.drop(64) |
| 18 | + | print("empty tablets: " ..countContent(emptyTabletsKey))
|
| 19 | - | end |
| 19 | + | sleep(30) |
| 20 | - | sleep(10) |
| 20 | + | end |