Advertisement
Guest User

startup

a guest
Aug 30th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. modem = peripheral.wrap("back")
  2. modem.open(3)
  3. modem.open(20)
  4. modem.open(55)
  5.  
  6. function sendMessage()
  7. print("send what")
  8. message = read()
  9. print ("what channel")
  10. channel = read()
  11. channel_number = tonumber(channel)
  12. modem.transmit(channel_number_number.message)
  13. print("message sent")
  14. sleep(1)
  15. os.reboot()
  16. end
  17.  
  18. print("what do you want")
  19. while true do
  20. local event,p1,p2,p3,p4 = os.pullEvent()
  21.  
  22. if event == "modem_message" then
  23. print(event)
  24. print(p1)
  25. print(p2)
  26. print(p3)
  27. print(p4)
  28. sleep(8)
  29.  
  30. print("Send a reply?")
  31. reply = read()
  32. if reply == "y" then
  33. sendMessage()
  34. else
  35. os.reboot()
  36. end
  37. end
  38.  
  39. if event == "key" then
  40. if p1 == keys.s then
  41. sendMessage()
  42. end
  43. end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement