Dr_Respektlos

messanger

Mar 8th, 2022 (edited)
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. -- requires pastebin gt4UdYGf saved as receive on same advanced computer (pastebin get gt4UdYGf receive)--
  2. function start()
  3.     term.clear()
  4.     term.setCursorPos(1, 1)
  5.     print("---------------------------------------------------")
  6.     print("|           Enter the ID you want                 |")
  7.     print("|           to send a messange to                 |")
  8.     print("|                                                 |")
  9.     print("---------------------------------------------------")
  10.     idtext = read()
  11.     id = tonumber(idtext)
  12.     if id == nil then
  13.         start()
  14.     else
  15.         send()
  16.     end
  17. end
  18. function send()
  19.     term.clear()
  20.     term.setCursorPos(1, 1)
  21.     if id >= 10 then
  22.         space = " "
  23.     else
  24.         space = "  "
  25.     end
  26.     print("---------------------------------------------------")
  27.     print("|           Enter the message you want            |")
  28.     print("|           to send a messange to ID: ", id, space, "      |")
  29.     print("|                                                 |")
  30.     print("---------------------------------------------------")
  31.     message = read()
  32.     ask()
  33. end
  34. function ask()
  35.     print("Are you sure you want to send this message? (y/n)")
  36.     input = read()
  37.     if input == "y" then
  38.         rednet.send(id, message)
  39.         term.clear()
  40.         term.setCursorPos(1, 1)
  41.         print("message has benn sent")
  42.         for i = 1, 5 do
  43.             sleep(0.5)
  44.             print(".")
  45.         end
  46.         start()
  47.     elseif input == "n" then
  48.         send()
  49.     else
  50.         ask()
  51.     end
  52. end
  53. shell.openTab("receive")
  54. start()
Add Comment
Please, Sign In to add comment