Advertisement
User9684

Killbot computer

Nov 19th, 2022 (edited)
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. local proto = "killbotcontroller"
  2. rednet.open("back")
  3.  
  4. monitor = peripheral.wrap("right")
  5.  
  6. local toggled = false
  7.  
  8. -- This is insanely cursed
  9. local colors_ = {
  10. [true] = colors.lime,
  11. [false] = colors.red
  12. }
  13.  
  14. local function tog()
  15. rednet.broadcast(tostring(toggled), proto)
  16. monitor.setBackgroundColor(colors_[toggled])
  17. monitor.clear()
  18. end
  19.  
  20. term.clear()
  21. print('Hit the "T" key to toggle killbots!')
  22.  
  23. while true do
  24. tog()
  25. event, m, mes, pro = os.pullEvent()
  26. if event == 'char' and string.lower(m) == 't' then
  27. toggled = (not toggled)
  28. term.clear()
  29. print('Hit the "T" key to toggle killbots!')
  30. tog()
  31. elseif event == 'rednet_message' and pro == 'togglemykillbots' then
  32. toggled = (not toggled)
  33. tog()
  34. end
  35. end
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement