Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function updatePlayer(colour, name, order)
- if rs.testBundledInput("left", order) then
- mon.setTextColor(colors.green)
- mon.setCursorPos(2,((2*order)+2))
- mon.clearLine()
- mon.write(name .. ": online")
- else
- mon.setTextColor(colors.red)
- mon.setCursorPos(2,((2*order)+2))
- mon.clearLine()
- mon.write(name .. ": offline")
- end
- end
- function updatePower(computerID, name, order)
- rednet.send(computerID, "getPower")
- local senderId, message, distance = rednet.receive(2)
- --print(computerID .. " : " .. message)
- if message == "empty" then
- mon.setTextColor(colors.red)
- mon.setCursorPos(2,(4+(players * 2)+(2*order)))
- mon.clearLine()
- mon.write(name .. ": EMPTY")
- elseif message == "full" then
- mon.setTextColor(colors.green)
- mon.setCursorPos(2,(4+(players * 2)+(2*order)))
- mon.clearLine()
- mon.write(name .. ": FULL")
- elseif message == "part" then
- mon.setTextColor(colors.yellow)
- mon.setCursorPos(2,(4+(players * 2)+(2*order)))
- mon.clearLine()
- mon.write(name .. ": PART FULL")
- else
- mon.setTextColor(colors.red)
- mon.setCursorPos(2,(4+(players * 2)+(2*order)))
- mon.clearLine()
- mon.write(name .. ": NOT RESPONDING")
- end
- end
- function loadPlayers()
- updatePlayer(1, "Matt", 1)
- updatePlayer(2, "David", 2)
- updatePlayer(4, "Chris", 3)
- updatePlayer(8, "Edwin", 4)
- end
- function loadPower()
- updatePower(1299, "MFE 1", 1)
- updatePower(1303, "MFE 2", 2)
- end
- function update()
- loadPlayers()
- loadPower()
- sleep(0.5)
- end
- function setup()
- mon = peripheral.wrap("top")
- rednet.open("right")
- mon.setTextScale(1)
- players = 4
- end
- setup()
- while true do
- update()
- end
Advertisement
Add Comment
Please, Sign In to add comment