Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args={...}
- if #args<2 then
- error("required arguments: monitorName, senderName ")
- end
- mName=args[1]
- sName=args[2]
- rednet.open("back")
- print("monitor: "..mName)
- print("sender: "..sName)
- sidesAvailable={"left","right","top","bottom","front","back"}
- storages={}
- c=0
- for i,side in pairs(sidesAvailable) do
- if peripheral.getType(side)=="IE:mvCapacitor" then
- storages[side]=peripheral.wrap(side)
- c=c+1
- print("found storage: "..side)
- end
- end
- if c==0 then
- print("didn't find any storages")
- end
- if c>0 then
- while true do
- text="textToMonitor:"..mName..":"..sName..":"
- c=0
- for side,storage in pairs(storages) do
- if c==1 then
- text=text.."\n"
- end
- c=1
- text=text..side..":"..storage.getEnergyStored().."/"..storage.getMaxEnergyStored()
- end
- rednet.broadcast(text,"monitoring")
- sleep(1)
- end
- end
Add Comment
Please, Sign In to add comment