Advertisement
Guest User

startup

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