Advertisement
sirtussin

face

Feb 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.37 KB | None | 0 0
  1. speaker = peripheral.wrap("left")
  2. monitor1 = peripheral.wrap("top")
  3. rednet.open("right")
  4.  
  5. client = 1
  6.  
  7. --face-------------------------------------
  8. function face()
  9. monitor1.clear()
  10. --lefteye
  11. monitor1.setCursorPos(5,2)
  12. monitor1.write("##")
  13. monitor1.setCursorPos(5,3)
  14. monitor1.write("##")
  15. --lefteye
  16. --righteye
  17. monitor1.setCursorPos(13,2)
  18. monitor1.write("##")
  19. monitor1.setCursorPos(13,3)
  20. monitor1.write("##")
  21. --righteye
  22. --mouth
  23. monitor1.setCursorPos(6,6)
  24. monitor1.write("########")
  25. monitor1.setCursorPos(6,7)
  26. monitor1.write("########")
  27. --mouth
  28. --textbox
  29. monitor1.setCursorPos(1,9)
  30. monitor1.write("------------------")
  31. monitor1.setCursorPos(1,12)
  32. monitor1.write("------------------")
  33. end
  34. --textbox
  35. --begin text at 1,10
  36. --face------------------------------------
  37.  
  38. --faceblink-------------------------------
  39. function faceblink()
  40. monitor1.clear()
  41. --lefteye
  42. monitor1.setCursorPos(5,3)
  43. monitor1.write("##")
  44. --lefteye
  45. --righteye
  46. monitor1.setCursorPos(13,3)
  47. monitor1.write("##")
  48. --righteye
  49. --mouth
  50. monitor1.setCursorPos(6,6)
  51. monitor1.write("########")
  52. monitor1.setCursorPos(6,7)
  53. monitor1.write("########")
  54. --mouth
  55. --textbox
  56. monitor1.setCursorPos(1,9)
  57. monitor1.write("------------------")
  58. monitor1.setCursorPos(1,12)
  59. monitor1.write("------------------")
  60. end
  61. --textbox
  62. --begin text at 1,10
  63. --faceblink-------------------------------
  64.  
  65. --facelookleft----------------------------
  66. function facelookleft()
  67. monitor1.clear()
  68. --lefteye
  69. monitor1.setCursorPos(4,2)
  70. monitor1.write("##")
  71. monitor1.setCursorPos(4,3)
  72. monitor1.write("##")
  73. --lefteye
  74. --righteye
  75. monitor1.setCursorPos(12,2)
  76. monitor1.write("##")
  77. monitor1.setCursorPos(12,3)
  78. monitor1.write("##")
  79. --righteye
  80. --mouth
  81. monitor1.setCursorPos(6,6)
  82. monitor1.write("########")
  83. monitor1.setCursorPos(6,7)
  84. monitor1.write("########")
  85. --mouth
  86. --textbox
  87. monitor1.setCursorPos(1,9)
  88. monitor1.write("------------------")
  89. monitor1.setCursorPos(1,12)
  90. monitor1.write("------------------")
  91. end
  92. --textbox
  93. --begin text at 1,10
  94. --facelookleft---------------------------
  95.  
  96. --facelookright--------------------------
  97. function facelookright()
  98. monitor1.clear()
  99. --lefteye
  100. monitor1.setCursorPos(6,2)
  101. monitor1.write("##")
  102. monitor1.setCursorPos(6,3)
  103. monitor1.write("##")
  104. --lefteye
  105. --righteye
  106. monitor1.setCursorPos(14,2)
  107. monitor1.write("##")
  108. monitor1.setCursorPos(14,3)
  109. monitor1.write("##")
  110. --righteye
  111. --mouth
  112. monitor1.setCursorPos(6,6)
  113. monitor1.write("########")
  114. monitor1.setCursorPos(6,7)
  115. monitor1.write("########")
  116. --mouth
  117. --textbox
  118. monitor1.setCursorPos(1,9)
  119. monitor1.write("------------------")
  120. monitor1.setCursorPos(1,12)
  121. monitor1.write("------------------")
  122. end
  123. --textbox
  124. --begin text at 1,10
  125. --facelookright-------------------------
  126.  
  127. ---------------------------------------------------------face^^^^^^^^
  128. --xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  129.  
  130.  
  131. --functions
  132.  
  133. function facemotion()
  134. local blinktime = math.random(8,11)
  135. local looker = math.random(2,9)
  136. face()
  137. sleep(blinktime)
  138.   if looker == 3 then
  139.   facelookright()
  140.   sleep(2)
  141.   elseif looker == 6 then
  142.   facelookleft()
  143.   sleep(2)
  144.   else
  145.   faceblink()
  146.   sleep(.1)
  147.   end
  148. end
  149.  
  150. function receive()
  151. while true do
  152.   id, msg = rednet.receive()
  153.   if id == client then
  154.   speaker.synthesize(msg, 5)
  155.   end
  156. end
  157. end
  158.  
  159. --function
  160.  
  161.  
  162.  
  163.  
  164. --main loop
  165.  
  166. while true do
  167. parallel.waitForAny(receive, facemotion)
  168. sleep(1)
  169. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement