SHOW:
|
|
- or go back to the newest paste.
| 1 | local ec = peripheral.find "ender_chest" | |
| 2 | local ecinv = peripheral.find "minecraft:ender chest" | |
| 3 | ||
| 4 | local f = fs.open("escan.log", "w")
| |
| 5 | ||
| 6 | local z = ... | |
| 7 | if z then | |
| 8 | ec.setFrequency(tonumber(z, 16)) | |
| 9 | return | |
| 10 | end | |
| 11 | ||
| 12 | for i = 0, 0xFFF do | |
| 13 | ec.setFrequency(i) | |
| 14 | local count = 0 | |
| 15 | for _, s in pairs(ecinv.list()) do | |
| 16 | count = count + s.count | |
| 17 | - | print(os.date "!%X", table.concat(ec.getFrequencyColors(), "/"), ("0x%03x"):format(i), count)
|
| 17 | + | |
| 18 | if count > 0 then | |
| 19 | - | sleep(0.1) |
| 19 | + | local log = ("%s %s 0x%03x %d"):format(os.date "!%X", table.concat(ec.getFrequencyColors(), "/"), i, count)
|
| 20 | - | end |
| 20 | + | print(log) |
| 21 | f.writeLine(log) | |
| 22 | end | |
| 23 | if i % 256 == 255 then | |
| 24 | f.flush() | |
| 25 | end | |
| 26 | os.queueEvent "" | |
| 27 | os.pullEvent "" | |
| 28 | end | |
| 29 | ||
| 30 | f.close() |