Advertisement
100Toby1

Untitled

Oct 19th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. speaker = peripheral.wrap("top")
  2. monitor = peripheral.wrap("right")
  3. chatbox = peripheral.wrap("bottom")
  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 figureState = false
  15. local tillChange = 5
  16.  
  17. if tillChange > 0 then
  18. drawFigure(figureState)
  19. sleep(0.3)
  20. figureState = not figureState
  21. tillChange = 5
  22. else
  23. tillChange = tillChange - 1
  24. end
  25.  
  26. local str = ""
  27. for i=0, text:len() do
  28. str = str .. string.sub(text,i,i)
  29. centerText(str)
  30. if (string.sub(text,i,i) == " ") then
  31. sleep(0.1);
  32. end
  33. sleep(0.05);
  34. end
  35. end
  36.  
  37. function writeAndTalk(text)
  38. monitor.clear()
  39. speaker.speak(text)
  40. writeSlow(text)
  41. end
  42.  
  43. function drawFigure(open)
  44. monitor.clear()
  45. monitor.setCursorPos(1,1)
  46. monitor.write(" |\\ /|")
  47. monitor.setCursorPos(1,2)
  48. monitor.write(" | \\ / |")
  49. monitor.setCursorPos(1,3)
  50. monitor.write(" '_^''^_'")
  51. monitor.setCursorPos(1,4)
  52. monitor.write(" /__/// \\")
  53. monitor.setCursorPos(1,5)
  54. monitor.write(" |[]--[]|")
  55. monitor.setCursorPos(1,6)
  56. monitor.write(" | __ |")
  57. monitor.setCursorPos(1,7)
  58. if open then
  59. monitor.write(" \\ /__\\ /")
  60. monitor.setCursorPos(1,8)
  61. monitor.write(" __'\\__/'__")
  62. else
  63. monitor.write(" \\ /vv\\ /")
  64. monitor.setCursorPos(1,8)
  65. monitor.write(" __'\\--/'__")
  66. end
  67. monitor.setCursorPos(1,9)
  68. monitor.write(" - . . -")
  69. end
  70.  
  71. monitor.clear()
  72.  
  73. while true do
  74. writeAndTalk("Enter the password, bitch")
  75.  
  76. local chatevent, player, message = os.pullEvent("chat")
  77.  
  78. if (rs.getInput("back")) then
  79. monitor.clear();
  80. monitor.setCursorPos(1,1)
  81.  
  82. if (message == "yolo") then
  83. writeAndTalk("Cool and good my dude")
  84. sleep(2)
  85. else
  86. writeAndTalk("Fuck you,")
  87. sleep(0.3)
  88. writeAndTalk("Did you really think it was")
  89. sleep(0.3)
  90. writeAndTalk("'" .. message .. "?'")
  91. sleep(2)
  92. end
  93. end
  94.  
  95. if (message == "end") then
  96. monitor.clear();
  97. monitor.setCursorPos(1,1)
  98. monitor.write("Bye.")
  99. os.sleep(1)
  100. monitor.clear()
  101. os.exit(0)
  102. end
  103. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement