Advertisement
Charmander

Trivia

Nov 21st, 2012
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. * Note: lines 1-33 are not part of the script and should not be included when adding the script.
  2.  
  3. Trivia Script by Charmander
  4.  
  5. Setting up the script:
  6.  
  7. - Press F4 to open a prompt window after you have added this script to the "Remote" tab in your script editor. Enter the channel that trivia will be played in (ex: #trivia).
  8. - Type "//write questions.txt"; The window will make it appear as if nothing happened. However, this command will create "questions.txt" in your script directory.
  9.  
  10. Adding your questions:
  11.  
  12. - Type "//run questions.txt" to open the text file. Each line of the file will be a question.
  13. - Enter your questions in the following format: Question|answer~answer~answer~... (ex: Which of the following Pokemon can learn Psycho Boost legally?|Deoxys~Lugia)
  14. - As seen above, put a pipe (|) after the question, and separate each answer with a tilde (~). You can have as many answers as you like for each question; only one of the answers must be guessed to get the question right.
  15. - Go to the next line to add another question! Questions are chosen in order and will loop when the last question on the list has been asked.
  16. - Questions may not include pipes (|). Answers may not include pipes (|), tildes (~), or commas (,).
  17.  
  18. Playing the game:
  19.  
  20. - A player has 60 seconds to answer the current question. Anybody can answer the current question.
  21. - A player may only answer once. If their answer is incorrect, the player may not answer again until the next question.
  22. - The user who answers the question correctly first will get a point.
  23. - There is a 5 second time period in between a question being answered and a new question being presented.
  24.  
  25. Commands:
  26. !trivia [start the game]
  27. !halt [end the game]
  28. !score [check your score]
  29. !a <answer> [answer the question]
  30.  
  31. Enjoy!
  32. ~ Charmander
  33.  
  34. on *:text:!trivia:%channel: {
  35. if (%trivia != on && $regex($nick(%channel,$nick).pnick,/^[%@&~]/)) {
  36. set %trivia on
  37. question
  38. }
  39. }
  40. alias fail {
  41. if (%trivia == on) {
  42. unset %answer
  43. unset %question
  44. unset %thing
  45. msg %channel 02You failed to answer the question in time! Next question in 5 seconds!
  46. timer 1 5 question
  47. }
  48. }
  49. alias question {
  50. if (%trivia == on) {
  51. unset %block
  52. unset %wrong*
  53. $iif(%order == $lines(questions.txt),set %order 1,inc %order)
  54. set %thing $read(questions.txt,%order)
  55. set %question $gettok(%thing,1,124)
  56. set %answer $gettok(%thing,2,124)
  57. inc %number
  58. msg %channel 04Question %number $+ :02 %question
  59. .timer1 1 60 fail
  60. }
  61. }
  62. on *:text:*:%channel: {
  63. if (%trivia == on) {
  64. if ($1 == !a && !$findtok(%wrong,$nick,32)) {
  65. if ($findtok(%answer,$2-,126)) {
  66. .timer1 off
  67. inc %score [ $+ [ $nick ] ]
  68. if ($numtok(%answer,126) <= 2) msg %channel 04 $+ $nick 02said the correct answer! The $iif($numtok(%answer,126) == 1,answer was 04 $+ %answer,answers were04 $gettok(%answer,1,126) and $gettok(%answer,2,126)) $+ 02. Next question in 5 seconds.
  69. else {
  70. var %temp 1
  71. while (%temp < $numtok(%answer,126)) {
  72. set -l %string %string $gettok(%answer,%temp,126) $+ $chr(44)
  73. inc %temp
  74. }
  75. set -l %string %string and $gettok(%answer,%temp,126)
  76. msg %channel 04 $+ $nick 02said the correct answer! The answers were04 %string $+ 02. Next question in 5 seconds.
  77. }
  78. unset %answer
  79. unset %thing
  80. unset %question
  81. timer 1 5 question
  82. set %block on
  83. }
  84. elseif (%block != on) {
  85. set %wrong %wrong $nick
  86. msg %channel 02The answer 04 $+ $2- 02was wrong.04 $nick 02may not guess again until the next question.
  87. }
  88. }
  89. elseif ($1 == !halt) {
  90. if ($regex($nick(%channel,$nick).pnick,/^[%@&~]/)) {
  91. .timer1 off
  92. unset %trivia
  93. unset %answer
  94. unset %thing
  95. unset %question
  96. unset %number
  97. msg %channel 02Trivia was stopped by 04 $+ $nick $+ 02!
  98. }
  99. }
  100. }
  101. if ($1 == !score) {
  102. notice $nick 02You have 04 $+ $iif(%score [ $+ [ $nick ] ],%score [ $+ [ $nick ] ],0) 02point(s)!
  103. }
  104. }
  105. alias F4 set %channel $$?="What channel would you like trivia to be hosted on?"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement