LeonZ_2019

scramble Runscript action

May 31st, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var text = msg.content.split(" ").slice(1,2).join(" ");
  2. var i;
  3. var textout = "";
  4. var scramble = [];
  5. for (i = 0; i < text.length; i++) {
  6.   scramble.push(text.charAt(i))
  7. }
  8. scramble.sort(function(a, b){return 0.5 - Math.random()});
  9. for (i = 0; i < scramble.length; i++) {
  10.   textout = textout + scramble[i]
  11. }
  12. while (textout == text) {
  13.   textout = "";
  14.   scramble.sort(function(a, b){return 0.5 - Math.random()});
  15.   for (i = 0; i < scramble.length; i++) {
  16.     textout = textout + scramble[i]
  17.   }
  18. }
  19. this.storeValue(textout,1,"textout",cache)
  20. this.storeValue(text,2,"answer",cache)
  21. msg.channel.send("Guess the word" + textout)
Advertisement
Add Comment
Please, Sign In to add comment