Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --opening rednet modem
  2. rednet.open("left")
  3. --wraping the top monitor
  4. mon = peripheral.find("monitor_")
  5. term.setCursorPos(1,1)
  6. term.clear()
  7. term.setBackgroundColor(colors.yellow)
  8.  
  9.  
  10. while true do
  11.  
  12. --waiting to receive a message from the server (server > client transfer)
  13. prot,id,msg = os.pullEvent("rednet_message")
  14.  
  15. if id == 3 then
  16.  
  17. if msg ~= "alarm" then
  18.  
  19. term.clear()
  20. term.setCursorPos(1,1)
  21. mon.clear()
  22. mon.setCursorPos(1,1)
  23. mon.setTextColor(colors.white)
  24. mon.write("Welcome "..msg)
  25. mon.setCursorPos(1,2)
  26. mon.write("Have a great Day")
  27. sleep(4)
  28. term.clear()
  29. term.setCursorPos(1,1)
  30. mon.clear()
  31. mon.setCursorPos(1,1)
  32. else
  33.  
  34. term.clear()
  35. term.setCursorPos(1,1)
  36. mon.clear()
  37. mon.setCursorPos(1,1)
  38. mon.setTextColor(colors.red)
  39. mon.write("Intruder Alert!")
  40. rs.setOutput("right",true)
  41. prot,id,msg = os.pullEvent("rednet_message")
  42.  
  43. if msg == "stop" then
  44.  
  45. term.clear()
  46. term.setCursorPos(1,1)
  47. mon.clear()
  48. mon.setCursorPos(1,1)
  49. rs.setOutput("right",false)
  50. os.reboot()
  51. else
  52. print("error")
  53.  
  54. else
  55.  
  56. print(":Warning: Unauthorized transmission has been received")
  57.  
  58.  
  59.  
  60. end
  61. end
  62. end
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement