Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local proto = "killbotcontroller"
- rednet.open("back")
- monitor = peripheral.wrap("right")
- local toggled = false
- -- This is insanely cursed
- local colors_ = {
- [true] = colors.lime,
- [false] = colors.red
- }
- local function tog()
- rednet.broadcast(tostring(toggled), proto)
- monitor.setBackgroundColor(colors_[toggled])
- monitor.clear()
- end
- term.clear()
- print('Hit the "T" key to toggle killbots!')
- while true do
- tog()
- event, m, mes, pro = os.pullEvent()
- if event == 'char' and string.lower(m) == 't' then
- toggled = (not toggled)
- term.clear()
- print('Hit the "T" key to toggle killbots!')
- tog()
- elseif event == 'rednet_message' and pro == 'togglemykillbots' then
- toggled = (not toggled)
- tog()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement