Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local glasses = peripheral.wrap("right")
- rednet.open("top")
- reactor = 16
- -- Create box
- function createBox()
- glasses.clear()
- glasses.addBox(5,20,50,50,0x000000,0.2)
- glasses.addText(10,25,"Reactor",0x385E9C)
- glasses.sync()
- end
- -- Default status
- function default()
- rednet.send(reactor,"roff")
- glasses.addText(10,35,"Offline",0x9C3838)
- glasses.sync()
- end
- -- Get status
- function status()
- rednet.send(reactor,"status")
- id, stat = rednet.receive(5)
- if stat == true then
- glasses.clear()
- createBox()
- glasses.addText(10,35,"Online",0x389C51)
- glasses.sync()
- elseif stat == false then
- glasses.clear()
- createBox()
- glasses.addText(10,35,"Offline",0x9C3838)
- glasses.sync()
- else
- default()
- end
- end
- createBox()
- status()
- -- Commands
- while true do
- local event = { os.pullEvent() }
- if event[1] == "glasses_chat_command" then
- if event[5] == "ron" then
- rednet.send(reactor,"ron")
- sleep(1)
- status()
- elseif event[5] == "roff" then
- rednet.send(reactor,"roff")
- sleep(1)
- status()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment