jjloraine Novice
Joined: 10 Jul 2006 Posts: 30
|
Posted: Fri Feb 15, 2013 12:37 pm
Trivia Bot |
This is set up for IRE games, but I'm sure that you could tweak it for other MUDs by adjusting the triggers for responses and places to ask the questions.
TRIVIATIME (channel) - Start up trivia! Specify your method of asking questions, eg TRIVIATIME WT to ask questions via webtells, or TRIVIATIME SAY to ask questions via the say command
TRIVIASTOP - end the trivia and display final scores
TRIVIA - asks the next question and starts the timer
SKIPQ - manually force a skip to the questions if one is repeated
ATRIVIA - manually force an answer
CURRENTSCORE - displays the current scores
CURRENTQUESTION - displays the current question
Other people can also start the bot up for you. The magic syntax they need to say is "Trivia! Channel: whatever"
There aren't any questions in the bot right now, but the idea is that you fill in the stringlists triviaq and triviaa with questions and answers respectively. Questions and answers are moved to new variables once they've been asked so you don't get repeats (but they are saved in case you want to copypasta the whole list back to be reused!).
Have fun!
Code: |
#CLASS {trivia}
#ALIAS trivia {trivianumber=%random( 0, %numitems( @triviaq));currentquest=%item( @triviaq, @trivianumber);currentanswer=%item( @triviaa, @trivianumber);@triviachannel Next question: @currentquest;questionasked=1;#alarm triviaquestion +90 {#if @questionasked=1 {@triviachannel Time's up!;atrivia}}}
#ALIAS skipq {@triviachannel Psh, you've already had this one!;#untrigger triviaquestion;#additem questionsasked @currentquest;#additem answersasked @currentanswer;#delnitem triviaa @trivianumber;#delnitem triviaq @trivianumber;trivia}
#ALIAS atrivia {@triviachannel The answer was: @currentanswer;questionasked=0;trivia}
#ALIAS triviastop {@triviachannel Trivia done! Final score readout...;#loo 1,%numitems( @triviacontestants) {@triviachannel %item( @triviacontestants, %i): %item( @triviapoints, %i)};#untrigger triviaquestion;#t- trivia}
#ALIAS currentscore {@triviachannel Current Score!;#loo 1,%numitems( @triviacontestants) {@triviachannel %item( @triviacontestants, %i): %item( @triviapoints, %i)}}
#ALIAS currentquestion {@triviachannel Current question is: @currentquest}
#ALIAS correct { @triviachannel %1 is Correct!;#if (%ismember( %1, @triviacontestants)) {#var triviapoints %replaceitem( %eval( %item( @triviapoints, %ismember( %1, @triviacontestants))+1), %ismember( %1, @triviacontestants), @triviapoints)} {#var triviapoints %additem( 1, @triviapoints)};#additem triviacontestants %1;#untrigger triviaquestion;#additem questionsasked @currentquest;#additem answersasked @currentanswer;#delnitem triviaa @trivianumber;#delnitem triviaq @trivianumber;trivia}
#VAR triviaq {}
#VAR triviaa {}
#VAR questionsasked {}
#VAR answersasked {}
#TRIGGER {~(*~): (%w) says, ~"(*).~"} {givenanswer=%2;#if @currentanswer=@givenanswer {@triviachannel %1 is Correct!;#if (%ismember( %1, @triviacontestants)) {#var triviapoints %replaceitem( %eval( %item( @triviapoints, %ismember( %1, @triviacontestants))+1), %ismember( %1, @triviacontestants), @triviapoints)} {#var triviapoints %additem( 1, @triviapoints)};#additem triviacontestants %1;#untrigger triviaquestion;#additem questionsasked @currentquest;#additem answersasked @currentanswer;#delnitem triviaa @trivianumber;#delnitem triviaq @trivianumber;trivia}}
#TRIGGER {~(*~): (%w) says, ~"Question.~"} {currentquestion}
#TRIGGER {~(*~): (%w) says, ~"Score.~"} {currentscore}
#TRIGGER {~(*~): (%w) ~(from *~) says, ~"(*).~"} {givenanswer=%2;#if @currentanswer=@givenanswer {@triviachannel %1 is Correct!;#if (%ismember( %1, @triviacontestants)) {#var triviapoints %replaceitem( %eval( %item( @triviapoints, %ismember( %1, @triviacontestants))+1), %ismember( %1, @triviacontestants), @triviapoints)} {#var triviapoints %additem( 1, @triviapoints)};#additem triviacontestants %1;#untrigger triviaquestion;#additem questionsasked @currentquest;#additem answersasked @currentanswer;#delnitem triviaa @trivianumber;#delnitem triviaq @trivianumber;trivia}}
#TRIGGER {~(*~): (%w) ~(from *~) says, ~"Question.~"} {currentquestion}
#TRIGGER {~(*~): (%w) says, ~"Triviastop.~"} {triviastop}
#TRIGGER {~(*~): (%w) ~(from *~) says, ~"Score.~"} {currentscore}
#CLASS 0
#ALIAS triviatime {#t+ trivia;currentquestion=0;currentanswer=0;#var triviacontestants {};#var triviapoints {};triviachannel=%1;@triviachannel Time for Trivia! Answer here - say "Question" to repeat the question and "Score" to see the current score. "Triviastop" to turn off the trivia!;trivia}
#TRIGGER {~(*~): (%w) says, ~"Trivia! Channel: (%w).~"} {triviachannel=%2;@triviachannel Aye, aye %1!;triviatime} |
|
|