Advertisement
Guest User

startup

a guest
Mar 3rd, 2015
199
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. end
  12. if callans == "y" then
  13. while not mess == "endcall" do
  14. write("You: ")
  15. msg = read()
  16. rednet.send(id, msg)
  17. id2, mess2 = rednet.receive()
  18. print(id..": "..mess2)
  19. end
  20. end
  21. while true do
  22. print("1 Check for calls")
  23. print("2 Call someone")
  24. input = read()
  25. if input == "1" then
  26. print("Listening for 10 seconds.")
  27. listenToCalls(10)
  28. term.clear()
  29. term.setCursorPos(1,1)
  30. elseif input == "2" then
  31. print("What ID are you trying to call?")
  32. idtocall = read()
  33. rednet.send(tonumber(idtocall), "call")
  34. end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement