Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * Note: lines 1-33 are not part of the script and should not be included when adding the script.
- Trivia Script by Charmander
- Setting up the script:
- - 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).
- - 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.
- Adding your questions:
- - Type "//run questions.txt" to open the text file. Each line of the file will be a question.
- - Enter your questions in the following format: Question|answer~answer~answer~... (ex: Which of the following Pokemon can learn Psycho Boost legally?|Deoxys~Lugia)
- - 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.
- - 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.
- - Questions may not include pipes (|). Answers may not include pipes (|), tildes (~), or commas (,).
- Playing the game:
- - A player has 60 seconds to answer the current question. Anybody can answer the current question.
- - A player may only answer once. If their answer is incorrect, the player may not answer again until the next question.
- - The user who answers the question correctly first will get a point.
- - There is a 5 second time period in between a question being answered and a new question being presented.
- Commands:
- !trivia [start the game]
- !halt [end the game]
- !score [check your score]
- !a <answer> [answer the question]
- Enjoy!
- ~ Charmander
- on *:text:!trivia:%channel: {
- if (%trivia != on && $regex($nick(%channel,$nick).pnick,/^[%@&~]/)) {
- set %trivia on
- question
- }
- }
- alias fail {
- if (%trivia == on) {
- unset %answer
- unset %question
- unset %thing
- msg %channel 02You failed to answer the question in time! Next question in 5 seconds!
- timer 1 5 question
- }
- }
- alias question {
- if (%trivia == on) {
- unset %block
- unset %wrong*
- $iif(%order == $lines(questions.txt),set %order 1,inc %order)
- set %thing $read(questions.txt,%order)
- set %question $gettok(%thing,1,124)
- set %answer $gettok(%thing,2,124)
- inc %number
- msg %channel 04Question %number $+ :02 %question
- .timer1 1 60 fail
- }
- }
- on *:text:*:%channel: {
- if (%trivia == on) {
- if ($1 == !a && !$findtok(%wrong,$nick,32)) {
- if ($findtok(%answer,$2-,126)) {
- .timer1 off
- inc %score [ $+ [ $nick ] ]
- 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.
- else {
- var %temp 1
- while (%temp < $numtok(%answer,126)) {
- set -l %string %string $gettok(%answer,%temp,126) $+ $chr(44)
- inc %temp
- }
- set -l %string %string and $gettok(%answer,%temp,126)
- msg %channel 04 $+ $nick 02said the correct answer! The answers were04 %string $+ 02. Next question in 5 seconds.
- }
- unset %answer
- unset %thing
- unset %question
- timer 1 5 question
- set %block on
- }
- elseif (%block != on) {
- set %wrong %wrong $nick
- msg %channel 02The answer 04 $+ $2- 02was wrong.04 $nick 02may not guess again until the next question.
- }
- }
- elseif ($1 == !halt) {
- if ($regex($nick(%channel,$nick).pnick,/^[%@&~]/)) {
- .timer1 off
- unset %trivia
- unset %answer
- unset %thing
- unset %question
- unset %number
- msg %channel 02Trivia was stopped by 04 $+ $nick $+ 02!
- }
- }
- }
- if ($1 == !score) {
- notice $nick 02You have 04 $+ $iif(%score [ $+ [ $nick ] ],%score [ $+ [ $nick ] ],0) 02point(s)!
- }
- }
- alias F4 set %channel $$?="What channel would you like trivia to be hosted on?"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement