Advertisement
xXm0dzXx

Untitled

Apr 19th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. rednet.open("bottom")
  2. rednet.open("top")
  3. rednet.open("back")
  4. rednet.open("front")
  5. rednet.open("right")
  6. rednet.open("left")
  7.  
  8. function clear()
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. end
  12.  
  13. function receive()
  14. clear()
  15. print("Wireless Redstone v0.1 \n \n Choose a side \n")
  16. input = read()
  17. if input == "left" or input == "front" or input == "back" or input == "top" or input == "bottom" or input == "right" then
  18. print("Waiting...")
  19. print("ID:" ..os.getComputerID)
  20. while true do
  21. id, message = rednet.receive()
  22. if message == "activate" then
  23. rednet.setOutput(input, true)
  24. sleep(1)
  25. rednet.setOutput(input, false)
  26. end
  27. end
  28. else
  29. print("Invalid!")
  30. sleep(1)
  31. menu()
  32. end
  33. end
  34.  
  35. function menu()
  36. clear()
  37. print("Wireless Redstone v0.1 \n \n 1. Receive \n 2. Send \n")
  38. write("Choose: ")
  39. input = read()
  40. if input == "1" or input == 1 then
  41. receive()
  42. elseif input == "2" or input == 2 then
  43. write("\n Enter a ID: ")
  44. id = tonumber(read())
  45. rednet.send(id, "activate")
  46. print("On!")
  47. sleep(1)
  48. print("Off!")
  49. sleep(0.8)
  50. menu()
  51. else
  52. menu()
  53. end
  54. end
  55.  
  56. menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement