Advertisement
BluePsychoRanger

chat_reaction.sk

Aug 11th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.89 KB | None | 0 0
  1. #Chat Reaction by BluePsychoRanger
  2.  
  3.  
  4. options:
  5. mode: "both" #enabled modes (type, unscramble, or both)
  6.  
  7. randomString: false #uses random strings of words (forces "type" mode)
  8. # if you want it case sensitive, enable it in the SKRIPT config
  9. stringMin: 5 #random string minimum character length
  10. stringMax: 10 #random string maximum character length (cannot exceed 25)
  11. caseSensitive: true #only affects the display of random strings, if not enabled in SKRIPT config, answering will not be case sensitive
  12.  
  13. timeInt: 5 minutes #time between each reaction
  14. timeout: 30 seconds #time players have to answer
  15.  
  16. reward: give 1 gold nugget to {_reaction.winner} #skript event to trigger when player wins (use {_reaction.winner} to target winner)
  17.  
  18.  
  19.  
  20. variables:
  21. {reaction.type} = 0
  22. {reaction.chat} = false
  23. # words to be used (if the option "randomString" is true, this is ignored)
  24. {reaction.word::1} = "reaction"
  25. {reaction.word::2} = "minecraft"
  26. # add more words like the example (supports up to 25 characters per word)
  27.  
  28.  
  29.  
  30. every {@timeInt}:
  31. set {reaction.type} to random integer between 0 and 1
  32. if {@mode} is "type":
  33. set {reaction.type} to 0
  34. else if {@mode} is "unscramble":
  35. set {reaction.type} to 1
  36. if {@randomString} is true:
  37. set {reaction.type} to 0
  38. if {@randomString} is false:
  39. set {reaction.activeWord} to random element of {reaction.word::*}
  40. set {reaction.chat} to true
  41. if {reaction.type} is 0:
  42.  
  43. if {@randomString} is true:
  44. set {_length} to random integer between {@stringMin} and {@stringMax}
  45. loop {_length} times:
  46. set {_num} to loop-number
  47. if {@caseSensitive} is true:
  48. set {_randInt} to random integer between 1 and 52
  49. else:
  50. set {_randInt} to random integer between 1 and 26
  51. if {_randInt} is 1:
  52. set {_char.%{_num}%} to "a"
  53. else if {_randInt} is 2:
  54. set {_char.%{_num}%} to "b"
  55. else if {_randInt} is 3:
  56. set {_char.%{_num}%} to "c"
  57. else if {_randInt} is 4:
  58. set {_char.%{_num}%} to "d"
  59. else if {_randInt} is 5:
  60. set {_char.%{_num}%} to "e"
  61. else if {_randInt} is 6:
  62. set {_char.%{_num}%} to "f"
  63. else if {_randInt} is 7:
  64. set {_char.%{_num}%} to "g"
  65. else if {_randInt} is 8:
  66. set {_char.%{_num}%} to "h"
  67. else if {_randInt} is 9:
  68. set {_char.%{_num}%} to "i"
  69. else if {_randInt} is 10:
  70. set {_char.%{_num}%} to "j"
  71. else if {_randInt} is 11:
  72. set {_char.%{_num}%} to "k"
  73. else if {_randInt} is 12:
  74. set {_char.%{_num}%} to "l"
  75. else if {_randInt} is 13:
  76. set {_char.%{_num}%} to "m"
  77. else if {_randInt} is 14:
  78. set {_char.%{_num}%} to "n"
  79. else if {_randInt} is 15:
  80. set {_char.%{_num}%} to "o"
  81. else if {_randInt} is 16:
  82. set {_char.%{_num}%} to "p"
  83. else if {_randInt} is 17:
  84. set {_char.%{_num}%} to "q"
  85. else if {_randInt} is 18:
  86. set {_char.%{_num}%} to "r"
  87. else if {_randInt} is 19:
  88. set {_char.%{_num}%} to "s"
  89. else if {_randInt} is 20:
  90. set {_char.%{_num}%} to "t"
  91. else if {_randInt} is 21:
  92. set {_char.%{_num}%} to "u"
  93. else if {_randInt} is 22:
  94. set {_char.%{_num}%} to "v"
  95. else if {_randInt} is 23:
  96. set {_char.%{_num}%} to "w"
  97. else if {_randInt} is 24:
  98. set {_char.%{_num}%} to "x"
  99. else if {_randInt} is 25:
  100. set {_char.%{_num}%} to "y"
  101. else if {_randInt} is 26:
  102. set {_char.%{_num}%} to "z"
  103. else if {_randInt} is 27:
  104. set {_char.%{_num}%} to "A"
  105. else if {_randInt} is 28:
  106. set {_char.%{_num}%} to "B"
  107. else if {_randInt} is 29:
  108. set {_char.%{_num}%} to "C"
  109. else if {_randInt} is 30:
  110. set {_char.%{_num}%} to "D"
  111. else if {_randInt} is 31:
  112. set {_char.%{_num}%} to "E"
  113. else if {_randInt} is 32:
  114. set {_char.%{_num}%} to "F"
  115. else if {_randInt} is 33:
  116. set {_char.%{_num}%} to "G"
  117. else if {_randInt} is 34:
  118. set {_char.%{_num}%} to "H"
  119. else if {_randInt} is 35:
  120. set {_char.%{_num}%} to "I"
  121. else if {_randInt} is 36:
  122. set {_char.%{_num}%} to "J"
  123. else if {_randInt} is 37:
  124. set {_char.%{_num}%} to "K"
  125. else if {_randInt} is 38:
  126. set {_char.%{_num}%} to "L"
  127. else if {_randInt} is 39:
  128. set {_char.%{_num}%} to "M"
  129. else if {_randInt} is 40:
  130. set {_char.%{_num}%} to "N"
  131. else if {_randInt} is 41:
  132. set {_char.%{_num}%} to "O"
  133. else if {_randInt} is 42:
  134. set {_char.%{_num}%} to "P"
  135. else if {_randInt} is 43:
  136. set {_char.%{_num}%} to "Q"
  137. else if {_randInt} is 44:
  138. set {_char.%{_num}%} to "R"
  139. else if {_randInt} is 45:
  140. set {_char.%{_num}%} to "S"
  141. else if {_randInt} is 46:
  142. set {_char.%{_num}%} to "T"
  143. else if {_randInt} is 47:
  144. set {_char.%{_num}%} to "U"
  145. else if {_randInt} is 48:
  146. set {_char.%{_num}%} to "V"
  147. else if {_randInt} is 49:
  148. set {_char.%{_num}%} to "W"
  149. else if {_randInt} is 50:
  150. set {_char.%{_num}%} to "X"
  151. else if {_randInt} is 51:
  152. set {_char.%{_num}%} to "Y"
  153. else if {_randInt} is 52:
  154. set {_char.%{_num}%} to "Z"
  155.  
  156. loop {_length} times:
  157. set {_message} to "%{_char.1}%%{_char.2}%%{_char.3}%%{_char.4}%%{_char.5}%%{_char.6}%%{_char.7}%%{_char.8}%%{_char.9}%%{_char.10}%%{_char.11}%%{_char.12}%%{_char.13}%%{_char.14}%%{_char.15}%%{_char.16}%%{_char.17}%%{_char.18}%%{_char.19}%%{_char.20}%%{_char.21}%%{_char.22}%%{_char.23}%%{_char.24}%%{_char.25}%"
  158. replace all "<none>" with "" in {_message}
  159. set {reaction.activeWord} to {_message}
  160.  
  161. console command "tellraw @a ["""",{""text"":""["",""color"":""dark_gray""},{""text"":""Reaction"",""color"":""yellow"",""bold"":true},{""text"":""]"",""color"":""dark_gray"",""bold"":false},{""text"":"" Hover for the word to type!"",""color"":""aqua"",""hoverEvent"":{""action"":""show_text"",""value"":{""text"":"""",""extra"":[{""text"":""%{reaction.activeWord}%""}]}}}]"
  162.  
  163.  
  164. else if {reaction.type} is 1:
  165.  
  166. set {_length} to "%length of {reaction.activeWord}%" parsed as number
  167. loop {_length} times:
  168. set {_num} to loop-number
  169. set {_char} to first {_num} characters of {reaction.activeWord}
  170. set {_char::%{_num}%} to last character of {_char}
  171. loop {_length} times:
  172. set {_num} to loop-number
  173. set {_letter.%{_num}%} to random element of {_char::*}
  174. remove {_letter.%{_num}%} from {_char::*}
  175. set {_message} to "%{_letter.1}%%{_letter.2}%%{_letter.3}%%{_letter.4}%%{_letter.5}%%{_letter.6}%%{_letter.7}%%{_letter.8}%%{_letter.9}%%{_letter.10}%%{_letter.11}%%{_letter.12}%%{_letter.13}%%{_letter.14}%%{_letter.15}%%{_letter.16}%%{_letter.17}%%{_letter.18}%%{_letter.19}%%{_letter.20}%%{_letter.21}%%{_letter.22}%%{_letter.23}%%{_letter.24}%%{_letter.25}%"
  176. replace all "<none>" with "" in {_message}
  177.  
  178. console command "tellraw @a ["""",{""text"":""["",""color"":""dark_gray""},{""text"":""Reaction"",""color"":""yellow"",""bold"":true},{""text"":""]"",""color"":""dark_gray"",""bold"":false},{""text"":"" Hover for the word to unscramble!"",""color"":""aqua"",""hoverEvent"":{""action"":""show_text"",""value"":{""text"":"""",""extra"":[{""text"":""%{_message}%""}]}}}]"
  179.  
  180. set {reaction.win} to false
  181. set {reaction.time} to now
  182.  
  183. wait {@timeout}
  184. if {reaction.win} is false:
  185. console command "tellraw @a ["""",{""text"":""["",""color"":""dark_gray""},{""text"":""Reaction"",""color"":""yellow"",""bold"":true},{""text"":""]"",""color"":""dark_gray"",""bold"":false},{""text"":"" Nobody got the word in time :("",""color"":""red""}]"
  186. set {reaction.chat} to false
  187.  
  188.  
  189.  
  190. on chat:
  191. {reaction.chat} is true
  192. message is "%{reaction.activeWord}%"
  193. cancel event
  194. set {_reaction.timeWin} to now
  195. set {_reaction.winner} to player
  196. set {reaction.win} to true
  197.  
  198. if {reaction.type} is 0:
  199. console command "tellraw @a ["""",{""text"":""["",""color"":""dark_gray""},{""text"":""Reaction"",""color"":""yellow"",""bold"":true},{""text"":""]"",""color"":""dark_gray"",""bold"":false},{""text"":"" %{_reaction.winner}%"",""color"":""white""},{""text"":"" typed the word"",""color"":""green""},{""text"":"" %{reaction.activeWord}%"",""color"":""white""},{""text"":"" in"",""color"":""green""},{""text"":"" %difference between {_reaction.timeWin} and {reaction.time}%"",""color"":""white""},{""text"":""!"",""color"":""green""}]"
  200. else if {reaction.type} is 1:
  201. console command "tellraw @a ["""",{""text"":""["",""color"":""dark_gray""},{""text"":""Reaction"",""color"":""yellow"",""bold"":true},{""text"":""]"",""color"":""dark_gray"",""bold"":false},{""text"":"" %{_reaction.winner}%"",""color"":""white""},{""text"":"" unscrambled the word"",""color"":""green""},{""text"":"" %{reaction.activeWord}%"",""color"":""white""},{""text"":"" in"",""color"":""green""},{""text"":"" %difference between {_reaction.timeWin} and {reaction.time}%"",""color"":""white""},{""text"":""!"",""color"":""green""}]"
  202.  
  203. #event for winner (use {_reaction.winner} to reward the player)
  204. {@reward}
  205.  
  206.  
  207. on load:
  208. broadcast "&eThe Chat Reaction Skript by &9BluePsychoRanger&e has been reloaded"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement