Advertisement
Guest User

chatmenu

a guest
Jan 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. textutils.slowPrint("Welcome to SmedChat!")
  4. term.setCursorPos(1,3)
  5. textutils.slowPrint("Would you like to host a chat or join one?")
  6. term.setCursorPos(2,5)
  7. write(">")
  8. input = read()
  9. if input == "host" then
  10.   term.setCursorPos(2,7)
  11.   textutils.slowPrint("Hosting Selected!")
  12.   sleep(2)
  13.   term.clear()
  14.   term.setCursorPos(1,1)
  15.   textutils.slowPrint("Your chat is being hosted at: 27143")
  16.   sleep(1)
  17.   shell.run("chat host 27143")
  18. elseif input == "join" then
  19.   term.setCursorPos(2,7)
  20.   textutils.slowPrint("Joining Selected!")
  21.   sleep(2)
  22.   term.clear()
  23.   term.setCursorPos(1,1)
  24.   textutils.slowPrint("Enter a chat address:")
  25.   term.setCursorPos(2,3)
  26.   write(">")
  27.   chatid = read()
  28.   if chatid == "27143" then
  29.     term.clear()
  30.     term.setCursorPos(1,1)
  31.     textutils.slowPrint("Address Confirmed! Connecting to chatroom 27143...")
  32.     sleep(2)
  33.     textutils.slowPrint("Connected!")
  34.     sleep(1)
  35.     term.clear()
  36.     term.setCursorPos(1,1)
  37.     shell.run("chat join 27143 Unknown")
  38.   else
  39.     term.clear()
  40.     term.setCursorPos(1,1)
  41.     textutils.slowPrint("Address Invalid!")
  42.     textutils.slowPrint("Returning to menu...")
  43.     shell.run("chatmenu")
  44.   end
  45. else
  46.   term.setCursorPos(2,7)
  47.   textutils.slowPrint("Invalid Selection")
  48.   sleep(2)
  49.   shell.run("chatmenu")
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement