Advertisement
Guest User

password

a guest
Oct 18th, 2017
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. speaker = peripheral.wrap("top")
  2. monitor = peripheral.wrap("right")
  3. chatbox = peripheral.wrap("left")
  4.  
  5. function centerText(text)
  6.   local x,y = monitor.getSize()
  7.   local x2,y2 = monitor.getCursorPos()
  8.  
  9.   monitor.setCursorPos(math.ceil((x/2)-(text:len()/2)), y/2)
  10.   monitor.write(text)
  11. end
  12.  
  13. function writeSlow(text)
  14.   local str = ""
  15.   for i=0, text:len() do
  16.     str = str .. string.sub(text,i,i)
  17.     centerText(str)
  18.     if (string.sub(text,i,i) == " ") then
  19.       sleep(0.1);
  20.     end
  21.     sleep(0.05);
  22.   end
  23. end
  24.  
  25. function writeAndTalk(text)
  26.   monitor.clear()
  27.   speaker.speak(text)
  28.   writeSlow(text)
  29. end
  30.  
  31. monitor.clear()
  32. monitor.setTextScale(1.5)
  33.  
  34. while true do
  35.   writeAndTalk("Enter the password, bitch")
  36.  
  37.   local chatevent, player, message = os.pullEvent("chat")
  38.  
  39.   if (rs.getInput("front")) then
  40.     monitor.clear();
  41.     monitor.setCursorPos(1,1)
  42.    
  43.     if (message == "yolo") then
  44.       writeAndTalk("Cool and good my dude")
  45.       sleep(2)
  46.     else
  47.       writeAndTalk("Fuck you,")
  48.       sleep(0.3)
  49.       writeAndTalk("Did you really think it was")
  50.       sleep(0.3)
  51.       writeAndTalk("'" .. message .. "?'")
  52.       sleep(2)
  53.     end
  54.   end
  55.  
  56.   if (message == "end") then
  57.     monitor.clear();
  58.     monitor.setCursorPos(1,1)
  59.     monitor.write("Bye.")
  60.     os.sleep(1)
  61.     monitor.clear()
  62.     os.exit(0)
  63.   end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement