Advertisement
Guest User

startup

a guest
Mar 3rd, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. rednet.open("back")
  2. print("LUAPhone 1.0")
  3. function listenToCalls(time)
  4. id, mess = rednet.receive(tonumber(time))
  5. if mess == "call" then
  6. print("Someone is calling you!")
  7. print(id.." is trying to call you!")
  8. print("Answer? y/n")
  9. callans = read()
  10. end
  11. if callans == "y" then
  12. while not msg == "endcall" do
  13. write("You: ")
  14. msg = read()
  15. rednet.send(id, msg)
  16. id2, mess2 = rednet.receive()
  17. print(id..": "..mess2)
  18. end
  19. end
  20. while true do
  21. print("1 Check for calls")
  22. print("2 Call someone")
  23. input = read()
  24. if input == "1" then
  25. print("Listening for 10 seconds.")
  26. listenToCalls(10)
  27. term.clear()
  28. term.setCursorPos(1,1)
  29. elseif input == "2" then
  30. print("What ID are you trying to call?")
  31. idtocall = read()
  32. rednet.send(tonumber(idtocall), "call")
  33. end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement