Advertisement
Index154

VietnamCode

Jun 17th, 2020 (edited)
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. note = "database is the source with all the text in it";
  2. note = "input is the argument added by the user";
  3. note = "namesStrLower is a list of only true names in lowercase";
  4.  
  5. upnext = "Split database into individual arrays";
  6. databases = database.split("######################################################################################");
  7. namesStr = databases[0];
  8. names = namesStr.split(";");
  9. wrongNames = databases[1].split(";");
  10. categories = databases[2].split(";");
  11. descriptions = databases[3].split(";");
  12.  
  13. upnext = "Generate random number to use for determining the output";
  14. randomNum = Math.floor(Math.random() * 251);
  15.  
  16. upnext = "Check if the input can be found in the lists of true names. If yes then determine the index of that element and use it instead of the random number";
  17. if(input == ""){}else{
  18. if(namesStr.indexOf(input) == -1){
  19. if(namesStrLower.indexOf(input) == -1){}else{
  20. names1 = namesStrLower.replace(input, "!#");
  21. names2 = names1.replace(/[^!#;]/g, "");
  22. randomNum = names2.indexOf("!#");
  23. }
  24. }else{
  25. names1 = namesStr.replace(input, "!#");
  26. names2 = names1.replace(/[^!#;]/g, "");
  27. randomNum = names2.indexOf("!#");
  28. }
  29. }
  30.  
  31. upnext = "Create output and send it";
  32. output = "```[Name:] " + wrongNames[randomNum] + "``````[Species:] " + categories[randomNum] + "``````[Description:] " + descriptions[randomNum] + "```(Real name: ||" + names[randomNum] + "||)";
  33. output;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement