Teal's MU* Trivia Bot
A classic IRC class trivia bot brought to the MU* realm. Sits and listens on a set channel and responds to !commands and trivia guesses. Fun to be had!
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for Teal's MU* Trivia Bot
@@ Project TealTrivBot
@@ Version 2
@@
@@ Description:
@@ A classic IRC class trivia bot brought to the MU* realm.
@@ Sits and listens on a set channel and responds to !commands
@@ and trivia guesses. Fun to be had!
@@
@@ Version log:
@@ Author: Teal <Mush>
@@ Date: Thu Dec 11 12:49:42 2008 -0800
@@ v2v
@@
@@ initial TealTrivBot commit
@@
@@ Readme:
@@ Only requirements are access to a channel and proper
@@ privileges to @chat and cemit on that channel. Also requires
@@ pemit_all powers. Remaining notes and requirements on the
@@ created object's description attribute.
@@
@@ Language: MushCode
@@ Installer file created by RubySVC (Softcode Version Control)
@@
@@
@@
@@ Creating Rooms, Things and Exits.
@@
@@
@set me=SVC`T9163a493bcfdb322222b:[default(SVC`T9163a493bcfdb322222b,create(T9163a493bcfdb322222b))]
@@
@@
@@ Objects created, now setting attributes, locks, etc.
@@
@@
@@
@@ Filling out Teal's MU* Trivia Bot
@@
@name [v(SVC`T9163a493bcfdb322222b)]=Teal's MU* Trivia Bot
@set [v(SVC`T9163a493bcfdb322222b)]=iter(setdiff(lflags([v(SVC`T9163a493bcfdb322222b)]),MONITOR NO_COMMAND VISUAL),!##) [setdiff(MONITOR NO_COMMAND VISUAL,lflags([v(SVC`T9163a493bcfdb322222b)]))]
&STARTUP_OLD [v(SVC`T9163a493bcfdb322222b)]=&i_active me=0;@tr me/fun_loop
&I_VER [v(SVC`T9163a493bcfdb322222b)]=0.1 Alpha
&I_SECS [v(SVC`T9163a493bcfdb322222b)]=1186472307
&I_QUEST_9 [v(SVC`T9163a493bcfdb322222b)]=Who sang 'Another One Bites The Dust'?|Queen
&I_QUEST_8 [v(SVC`T9163a493bcfdb322222b)]=Who sailed to the new world in 'The Mayflower'?|Pilgrims
&I_QUEST_7 [v(SVC`T9163a493bcfdb322222b)]=What is the only word in the English language that ends in the letters 'mt'?|Dreamt
&I_QUEST_6 [v(SVC`T9163a493bcfdb322222b)]=What is the name of Mr. Krane's dog on Frasier?|Eddie
&I_QUEST_5 [v(SVC`T9163a493bcfdb322222b)]=What is the full name of the ship in Code:Lyoko?|Skidbladnir
&I_QUEST_46 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a p s r n s w e e p|Newspapers
&I_QUEST_45 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a n r k o|Akron
&I_QUEST_44 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a n n a t m s t a h|Manhattans
&I_QUEST_43 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a n a e w b n|Wannabe
&I_QUEST_42 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a l i a m d r|Admiral
&I_QUEST_41 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a k i d n m n|Mankind
&I_QUEST_40 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a i a s l f c|Facials
&I_QUEST_4 [v(SVC`T9163a493bcfdb322222b)]=What is the 'pound' or 'number' symbol on the telephone?|Octothorpe
&I_QUEST_39 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a i a f n r o c i l|California
&I_QUEST_38 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a e s n i t p e l|Palestine
&I_QUEST_37 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a e r s o|Arose
&I_QUEST_36 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a e e e t g n|Teenage
&I_QUEST_35 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a d t i s n e|Instead
&I_QUEST_34 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a d e s h g n|Gnashed
&I_QUEST_33 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a c l i i t|Italic
&I_QUEST_32 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a a p n a m|Panama
&I_QUEST_31 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a a j o n v|Navajo
&I_QUEST_30 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a a g d e m n|Managed
&I_QUEST_3 [v(SVC`T9163a493bcfdb322222b)]=What does an Oologist study?|Eggs
&I_QUEST_29 [v(SVC`T9163a493bcfdb322222b)]=What was the name of Eddie Murphy's character in Beverly Hills Cop?|Axel Foley
&I_QUEST_28 [v(SVC`T9163a493bcfdb322222b)]=What was the name (4 letters) of the New York night club that helped launch the career of several early new wave groups?|CBGB's
&I_QUEST_27 [v(SVC`T9163a493bcfdb322222b)]=What was the leading cause of death in the late 19th century?|Tuberculosis
&I_QUEST_26 [v(SVC`T9163a493bcfdb322222b)]=What was the former name of Burkina Faso in Africa?|Upper Volta
&I_QUEST_25 [v(SVC`T9163a493bcfdb322222b)]=What was the former German name of the Czech town of Ceske Budejovice?|Budweis
&I_QUEST_24 [v(SVC`T9163a493bcfdb322222b)]=What was the first video MTV played?|Video Killed the Radio Star
&I_QUEST_23 [v(SVC`T9163a493bcfdb322222b)]=What was the first U.S consumer product sold in the Soviet Union?|Pepsi Cola
&I_QUEST_22 [v(SVC`T9163a493bcfdb322222b)]=What was the first name of the baby girl who fell down the well?|Jessica
&I_QUEST_21 [v(SVC`T9163a493bcfdb322222b)]=What was the first motion picture to have a synchronized musical score?|Don
&I_QUEST_20 [v(SVC`T9163a493bcfdb322222b)]=what was the first disney film to feature stereophonic sound?|Fantasia
&I_QUEST_2 [v(SVC`T9163a493bcfdb322222b)]=What did Dan Aykroyd and John Belushi quit 'Saturday Night Live' to become?|Blues Brothers
&I_QUEST_19 [v(SVC`T9163a493bcfdb322222b)]=What was the first computer software company to go public on the New York Stock Exchange?|Cullinet
&I_QUEST_18 [v(SVC`T9163a493bcfdb322222b)]=What was the first commercial readymix food?|Pancake Mix
&I_QUEST_17 [v(SVC`T9163a493bcfdb322222b)]=What was the famous line uttered by an old woman in Wendy's ads?|Where's The Beef?
&I_QUEST_16 [v(SVC`T9163a493bcfdb322222b)]=Who sang the title theme of the James Bond film 'A View to a Kill'?|Duran Duran
&I_QUEST_15 [v(SVC`T9163a493bcfdb322222b)]=Who sang the song from the Disney movie Lion King: 'Can You Feel The Love Tonight?|Elton John
&I_QUEST_14 [v(SVC`T9163a493bcfdb322222b)]=Who sang about the fall of man in 'The Tall Oak Tree'?|Dorsey Burnette
&I_QUEST_13 [v(SVC`T9163a493bcfdb322222b)]=Who sang about Desmond and Molly Jones?|The Beatles
&I_QUEST_12 [v(SVC`T9163a493bcfdb322222b)]=Who sang 'Think' in the original 'Blues Brothers' film?|Aretha Franklin
&I_QUEST_11 [v(SVC`T9163a493bcfdb322222b)]=Who sang 'Friends In Low Places' and 'Thunder Rolls'?|Garth Brooks
&I_QUEST_10 [v(SVC`T9163a493bcfdb322222b)]=Who sang 'Foolish Games'?|Jewel
&I_QUEST_1 [v(SVC`T9163a493bcfdb322222b)]=This number comes after one.|two
&I_NAME [v(SVC`T9163a493bcfdb322222b)]=[ansi(mh,Mu)][ansi(c,Triv)]
&I_LAST_ANSW_CORR [v(SVC`T9163a493bcfdb322222b)]=0
&I_CURR_QUEST [v(SVC`T9163a493bcfdb322222b)]=25
&I_ACTIVE [v(SVC`T9163a493bcfdb322222b)]=0
&FUN_WORK [v(SVC`T9163a493bcfdb322222b)]=th [if([u(i_active)],[switch(1,[gte([sub([secs()],[u(i_secs)])],120)],[cemit([first([channels(me)])],[u(fun_pre)]Times up! The correct answer was '[last([u(i_quest_[u(i_curr_quest)])],|)]'.,1)];[set(me,i_curr_quest:[rand(1,[nattr(me/i_quest_*)])])];[set(me,i_secs:[secs()])];[cemit([first([channels(me)])],[u(fun_pre)]Next question: '[first([u(i_quest_[u(i_curr_quest)])],|)]',1)],[u(i_last_answ_corr)],[set(me,i_last_answ_corr:0)];[set(me,i_curr_quest:[rand(1,[nattr(me/i_quest_*)])])];[set(me,i_secs:[secs()])];[cemit([first([channels(me)])],[u(fun_pre)]Next question: '[first([u(i_quest_[u(i_curr_quest)])],|)]'.,1)])],)]
&FUN_PRE [v(SVC`T9163a493bcfdb322222b)]=[ansi(mh,Mu)][ansi(c,Triv)]:%b
&FUN_LOOP [v(SVC`T9163a493bcfdb322222b)]=@tr me/fun_work;@wait 2=@tr me/fun_loop
&FUN_BFOOTER [v(SVC`T9163a493bcfdb322222b)]=ansi(bh,repeat(%1,div(sub(%0,add(5,strlen(setr(0,%?)))),strlen(%1)))\[)[ansi(wh,%q0)][ansi(bh,\][repeat(%1,div(3,strlen(%1)))])]
&FUN_BCENTER [v(SVC`T9163a493bcfdb322222b)]=ansi(bh,repeat(%2,div(3,strlen(%2)))\[)[ansi(wh,%0)][ansi(bh,\][repeat(%2,div(sub(%1,add(5,strlen(%0))),strlen(%2)))]
&DESCRIBE [v(SVC`T9163a493bcfdb322222b)]=The MU* Trivia Bot is what it sounds like. It is a trivia bot designed and written entirely in Pennmush compatible softcode (only tested in 1.8.3p5-p6) copying methods from common IRC chat trivia bots. This code comes preloaded with a random set of questions, but you are fully encouraged to replace them or add to them as you wish following the existing format of '&i_quest_## trivbot=What is the color of the sky?|Blue' with incremental question numbers.%r%rREQUIREMENTS: 1 channel to run the trivia session on (Recommended it's own trivia-centric channel due to spammyness), cemit and chat_privs and pemit_all @power in addition to monitor flag.%r%rINSTALLATION: Clone this code to your own mush. @power cemit, chat_privs, and pemit_all. Set !Halt and monitor flags. Create trivia channel if not already made and @chan/on the trivia bot object. @trigger the FUN_LOOP attribute and copy the startup_old attribute to it's own startup attribute. Finally, '+chan !help' to retrieve a list of commands for the bot.%r%rNOTE: MUST be on a single channel. If more than one channel, the first in it's 'examine' channel list is where it'll try to run. Recommended to be owned by a player with unlimited credits or set no_pay no_quota. It's unknown what affect is made on this during normal operation.%r%rv0.1 Alpha release by Teal@M*U*S*H, Antea/Teal@ProjectCarthage, or Vchat20/cr08 on the web. Limited support. If you make worthwhile modifications or improvements, I'd love to hear them. :)
&CMD_STOP [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!stop":th [if([orlflags([pmatch(%1)],wizard royalty)],[if([u(i_active)],[set(me,i_active:0)];[pemit([pmatch(%1)],[u(fun_pre)]The bot is now [ansi(rh,inactive)].)],[pemit([pmatch(%1)],[u(fun_pre)]The bot is already [ansi(rh,inactive)].)])],[pemit([pmatch(%1)],[u(fun_pre)]Please do not impersonate an administrator. Thank you.)])]
&CMD_STATS_PRIV [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!stats":th [if([hasattr(me,i_score_[pmatch(%1)])],[pemit([pmatch(%1)],[u(fun_pre)] Your current score is: [ansi(xh,[u(i_score_[pmatch(%1)])])])],[pemit([pmatch(%1)],[u(fun_pre)]You are not initialized in the trivia system. Please send the [ansi(g,!init)] command on the channel to join in.)])]
&CMD_START [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!start":th [if([orlflags([pmatch(%1)],wizard royalty)],[if([u(i_active)],[pemit([pmatch(%1)],[u(fun_pre)]The bot is already [ansi(gh,active)].)],[set(me,i_active:1)];[pemit([pmatch(%1)],[u(fun_pre)]The bot is now [ansi(gh,active)].)])],[pemit([pmatch(%1)],[u(fun_pre)]Please do not impersonate an administrator. Thank you.)])]
&CMD_PLAYER_ANSWER [v(SVC`T9163a493bcfdb322222b)]=^<*> * *:th [if([u(i_active)],[if([hasattr(me,i_score_[pmatch(%1)])],[if([strmatch(%2,*[last([u(i_quest_[u(i_curr_quest)])],|)]*)],[set(me,i_score_[pmatch(%1)]:[inc([u(i_score_[pmatch(%1)])])])];[cemit([first([channels(me)])],[u(fun_pre)][name([pmatch(%1)])] got this round! The answer is '[last([u(i_quest_[u(i_curr_quest)])],|)]'.,1)];[set(me,i_secs:[secs()])];[set(me,i_last_answ_corr:1)],)],)],)]
&CMD_INIT [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!init":th [set(me,i_score_[pmatch(%1)]:0)];th [pemit([pmatch(%1)],[u(fun_pre)]Your scores have been re-initialized. You may now participate on the Trivia Channel.)]
&CMD_HELP [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!help":@pemit [pmatch(%1)]=[u(fun_bcenter,[u(i_name)] [ansi(yh,Help System)],80,=)]%rThe [u(i_name)] Bot is your run of the mill Trivia Bot custom built to run on pennmush systems. Much like any other Trivia Bot, it relies on correct answers being sent through the trivia channel to be valid. All answers have to be spelled correctly or else they won't be viewed as valid answers.%rCommands:%r[ansi(g,!init)] ~ (Re)Initialize yourself in the trivia system.%r[ansi(g,!about)] ~ Display a general about page about this bot.%r[ansi(g,!start)] ~ Restarts the bot from a stopped state. (Admin only command)%r[ansi(g,!stop)] ~ Stops the bot. (Admin only command)%r[u(fun_bfooter,80,=)]
&CMD_ABOUT [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!about":@pemit [pmatch(%1)]=[u(fun_bcenter,[u(i_name)] [ansi(yh,About Page)],80,=)]%rWelcome to [u(i_name)] version [ansi(y,[u(i_ver)])]. I have been created by [ansi(xh,[u(author)])] for use on any pennmush enabled game. Please do not plagiarize my work and enjoy the game.%r[u(fun_bfooter,80,=)]
&AUTHOR [v(SVC`T9163a493bcfdb322222b)]=Teal@M*U*S*H, Antea@ProjectCarthage, Vchat20/cr08 on the web.
@set [v(SVC`T9163a493bcfdb322222b)]/DESCRIBE=no_command visual prefixmatch public nearby
@@
@@ Triggering all startups, oncreates, onupdates.
@@
@@ Version 2
@@
@@ Description:
@@ A classic IRC class trivia bot brought to the MU* realm.
@@ Sits and listens on a set channel and responds to !commands
@@ and trivia guesses. Fun to be had!
@@
@@ Version log:
@@ Author: Teal <Mush>
@@ Date: Thu Dec 11 12:49:42 2008 -0800
@@ v2v
@@
@@ initial TealTrivBot commit
@@
@@ Readme:
@@ Only requirements are access to a channel and proper
@@ privileges to @chat and cemit on that channel. Also requires
@@ pemit_all powers. Remaining notes and requirements on the
@@ created object's description attribute.
@@
@@ Language: MushCode
@@ Installer file created by RubySVC (Softcode Version Control)
@@
@@
@@
@@ Creating Rooms, Things and Exits.
@@
@@
@set me=SVC`T9163a493bcfdb322222b:[default(SVC`T9163a493bcfdb322222b,create(T9163a493bcfdb322222b))]
@@
@@
@@ Objects created, now setting attributes, locks, etc.
@@
@@
@@
@@ Filling out Teal's MU* Trivia Bot
@@
@name [v(SVC`T9163a493bcfdb322222b)]=Teal's MU* Trivia Bot
@set [v(SVC`T9163a493bcfdb322222b)]=iter(setdiff(lflags([v(SVC`T9163a493bcfdb322222b)]),MONITOR NO_COMMAND VISUAL),!##) [setdiff(MONITOR NO_COMMAND VISUAL,lflags([v(SVC`T9163a493bcfdb322222b)]))]
&STARTUP_OLD [v(SVC`T9163a493bcfdb322222b)]=&i_active me=0;@tr me/fun_loop
&I_VER [v(SVC`T9163a493bcfdb322222b)]=0.1 Alpha
&I_SECS [v(SVC`T9163a493bcfdb322222b)]=1186472307
&I_QUEST_9 [v(SVC`T9163a493bcfdb322222b)]=Who sang 'Another One Bites The Dust'?|Queen
&I_QUEST_8 [v(SVC`T9163a493bcfdb322222b)]=Who sailed to the new world in 'The Mayflower'?|Pilgrims
&I_QUEST_7 [v(SVC`T9163a493bcfdb322222b)]=What is the only word in the English language that ends in the letters 'mt'?|Dreamt
&I_QUEST_6 [v(SVC`T9163a493bcfdb322222b)]=What is the name of Mr. Krane's dog on Frasier?|Eddie
&I_QUEST_5 [v(SVC`T9163a493bcfdb322222b)]=What is the full name of the ship in Code:Lyoko?|Skidbladnir
&I_QUEST_46 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a p s r n s w e e p|Newspapers
&I_QUEST_45 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a n r k o|Akron
&I_QUEST_44 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a n n a t m s t a h|Manhattans
&I_QUEST_43 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a n a e w b n|Wannabe
&I_QUEST_42 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a l i a m d r|Admiral
&I_QUEST_41 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a k i d n m n|Mankind
&I_QUEST_40 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a i a s l f c|Facials
&I_QUEST_4 [v(SVC`T9163a493bcfdb322222b)]=What is the 'pound' or 'number' symbol on the telephone?|Octothorpe
&I_QUEST_39 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a i a f n r o c i l|California
&I_QUEST_38 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a e s n i t p e l|Palestine
&I_QUEST_37 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a e r s o|Arose
&I_QUEST_36 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a e e e t g n|Teenage
&I_QUEST_35 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a d t i s n e|Instead
&I_QUEST_34 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a d e s h g n|Gnashed
&I_QUEST_33 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a c l i i t|Italic
&I_QUEST_32 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a a p n a m|Panama
&I_QUEST_31 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a a j o n v|Navajo
&I_QUEST_30 [v(SVC`T9163a493bcfdb322222b)]=UnScramble this Word: a a g d e m n|Managed
&I_QUEST_3 [v(SVC`T9163a493bcfdb322222b)]=What does an Oologist study?|Eggs
&I_QUEST_29 [v(SVC`T9163a493bcfdb322222b)]=What was the name of Eddie Murphy's character in Beverly Hills Cop?|Axel Foley
&I_QUEST_28 [v(SVC`T9163a493bcfdb322222b)]=What was the name (4 letters) of the New York night club that helped launch the career of several early new wave groups?|CBGB's
&I_QUEST_27 [v(SVC`T9163a493bcfdb322222b)]=What was the leading cause of death in the late 19th century?|Tuberculosis
&I_QUEST_26 [v(SVC`T9163a493bcfdb322222b)]=What was the former name of Burkina Faso in Africa?|Upper Volta
&I_QUEST_25 [v(SVC`T9163a493bcfdb322222b)]=What was the former German name of the Czech town of Ceske Budejovice?|Budweis
&I_QUEST_24 [v(SVC`T9163a493bcfdb322222b)]=What was the first video MTV played?|Video Killed the Radio Star
&I_QUEST_23 [v(SVC`T9163a493bcfdb322222b)]=What was the first U.S consumer product sold in the Soviet Union?|Pepsi Cola
&I_QUEST_22 [v(SVC`T9163a493bcfdb322222b)]=What was the first name of the baby girl who fell down the well?|Jessica
&I_QUEST_21 [v(SVC`T9163a493bcfdb322222b)]=What was the first motion picture to have a synchronized musical score?|Don
&I_QUEST_20 [v(SVC`T9163a493bcfdb322222b)]=what was the first disney film to feature stereophonic sound?|Fantasia
&I_QUEST_2 [v(SVC`T9163a493bcfdb322222b)]=What did Dan Aykroyd and John Belushi quit 'Saturday Night Live' to become?|Blues Brothers
&I_QUEST_19 [v(SVC`T9163a493bcfdb322222b)]=What was the first computer software company to go public on the New York Stock Exchange?|Cullinet
&I_QUEST_18 [v(SVC`T9163a493bcfdb322222b)]=What was the first commercial readymix food?|Pancake Mix
&I_QUEST_17 [v(SVC`T9163a493bcfdb322222b)]=What was the famous line uttered by an old woman in Wendy's ads?|Where's The Beef?
&I_QUEST_16 [v(SVC`T9163a493bcfdb322222b)]=Who sang the title theme of the James Bond film 'A View to a Kill'?|Duran Duran
&I_QUEST_15 [v(SVC`T9163a493bcfdb322222b)]=Who sang the song from the Disney movie Lion King: 'Can You Feel The Love Tonight?|Elton John
&I_QUEST_14 [v(SVC`T9163a493bcfdb322222b)]=Who sang about the fall of man in 'The Tall Oak Tree'?|Dorsey Burnette
&I_QUEST_13 [v(SVC`T9163a493bcfdb322222b)]=Who sang about Desmond and Molly Jones?|The Beatles
&I_QUEST_12 [v(SVC`T9163a493bcfdb322222b)]=Who sang 'Think' in the original 'Blues Brothers' film?|Aretha Franklin
&I_QUEST_11 [v(SVC`T9163a493bcfdb322222b)]=Who sang 'Friends In Low Places' and 'Thunder Rolls'?|Garth Brooks
&I_QUEST_10 [v(SVC`T9163a493bcfdb322222b)]=Who sang 'Foolish Games'?|Jewel
&I_QUEST_1 [v(SVC`T9163a493bcfdb322222b)]=This number comes after one.|two
&I_NAME [v(SVC`T9163a493bcfdb322222b)]=[ansi(mh,Mu)][ansi(c,Triv)]
&I_LAST_ANSW_CORR [v(SVC`T9163a493bcfdb322222b)]=0
&I_CURR_QUEST [v(SVC`T9163a493bcfdb322222b)]=25
&I_ACTIVE [v(SVC`T9163a493bcfdb322222b)]=0
&FUN_WORK [v(SVC`T9163a493bcfdb322222b)]=th [if([u(i_active)],[switch(1,[gte([sub([secs()],[u(i_secs)])],120)],[cemit([first([channels(me)])],[u(fun_pre)]Times up! The correct answer was '[last([u(i_quest_[u(i_curr_quest)])],|)]'.,1)];[set(me,i_curr_quest:[rand(1,[nattr(me/i_quest_*)])])];[set(me,i_secs:[secs()])];[cemit([first([channels(me)])],[u(fun_pre)]Next question: '[first([u(i_quest_[u(i_curr_quest)])],|)]',1)],[u(i_last_answ_corr)],[set(me,i_last_answ_corr:0)];[set(me,i_curr_quest:[rand(1,[nattr(me/i_quest_*)])])];[set(me,i_secs:[secs()])];[cemit([first([channels(me)])],[u(fun_pre)]Next question: '[first([u(i_quest_[u(i_curr_quest)])],|)]'.,1)])],)]
&FUN_PRE [v(SVC`T9163a493bcfdb322222b)]=[ansi(mh,Mu)][ansi(c,Triv)]:%b
&FUN_LOOP [v(SVC`T9163a493bcfdb322222b)]=@tr me/fun_work;@wait 2=@tr me/fun_loop
&FUN_BFOOTER [v(SVC`T9163a493bcfdb322222b)]=ansi(bh,repeat(%1,div(sub(%0,add(5,strlen(setr(0,%?)))),strlen(%1)))\[)[ansi(wh,%q0)][ansi(bh,\][repeat(%1,div(3,strlen(%1)))])]
&FUN_BCENTER [v(SVC`T9163a493bcfdb322222b)]=ansi(bh,repeat(%2,div(3,strlen(%2)))\[)[ansi(wh,%0)][ansi(bh,\][repeat(%2,div(sub(%1,add(5,strlen(%0))),strlen(%2)))]
&DESCRIBE [v(SVC`T9163a493bcfdb322222b)]=The MU* Trivia Bot is what it sounds like. It is a trivia bot designed and written entirely in Pennmush compatible softcode (only tested in 1.8.3p5-p6) copying methods from common IRC chat trivia bots. This code comes preloaded with a random set of questions, but you are fully encouraged to replace them or add to them as you wish following the existing format of '&i_quest_## trivbot=What is the color of the sky?|Blue' with incremental question numbers.%r%rREQUIREMENTS: 1 channel to run the trivia session on (Recommended it's own trivia-centric channel due to spammyness), cemit and chat_privs and pemit_all @power in addition to monitor flag.%r%rINSTALLATION: Clone this code to your own mush. @power cemit, chat_privs, and pemit_all. Set !Halt and monitor flags. Create trivia channel if not already made and @chan/on the trivia bot object. @trigger the FUN_LOOP attribute and copy the startup_old attribute to it's own startup attribute. Finally, '+chan !help' to retrieve a list of commands for the bot.%r%rNOTE: MUST be on a single channel. If more than one channel, the first in it's 'examine' channel list is where it'll try to run. Recommended to be owned by a player with unlimited credits or set no_pay no_quota. It's unknown what affect is made on this during normal operation.%r%rv0.1 Alpha release by Teal@M*U*S*H, Antea/Teal@ProjectCarthage, or Vchat20/cr08 on the web. Limited support. If you make worthwhile modifications or improvements, I'd love to hear them. :)
&CMD_STOP [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!stop":th [if([orlflags([pmatch(%1)],wizard royalty)],[if([u(i_active)],[set(me,i_active:0)];[pemit([pmatch(%1)],[u(fun_pre)]The bot is now [ansi(rh,inactive)].)],[pemit([pmatch(%1)],[u(fun_pre)]The bot is already [ansi(rh,inactive)].)])],[pemit([pmatch(%1)],[u(fun_pre)]Please do not impersonate an administrator. Thank you.)])]
&CMD_STATS_PRIV [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!stats":th [if([hasattr(me,i_score_[pmatch(%1)])],[pemit([pmatch(%1)],[u(fun_pre)] Your current score is: [ansi(xh,[u(i_score_[pmatch(%1)])])])],[pemit([pmatch(%1)],[u(fun_pre)]You are not initialized in the trivia system. Please send the [ansi(g,!init)] command on the channel to join in.)])]
&CMD_START [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!start":th [if([orlflags([pmatch(%1)],wizard royalty)],[if([u(i_active)],[pemit([pmatch(%1)],[u(fun_pre)]The bot is already [ansi(gh,active)].)],[set(me,i_active:1)];[pemit([pmatch(%1)],[u(fun_pre)]The bot is now [ansi(gh,active)].)])],[pemit([pmatch(%1)],[u(fun_pre)]Please do not impersonate an administrator. Thank you.)])]
&CMD_PLAYER_ANSWER [v(SVC`T9163a493bcfdb322222b)]=^<*> * *:th [if([u(i_active)],[if([hasattr(me,i_score_[pmatch(%1)])],[if([strmatch(%2,*[last([u(i_quest_[u(i_curr_quest)])],|)]*)],[set(me,i_score_[pmatch(%1)]:[inc([u(i_score_[pmatch(%1)])])])];[cemit([first([channels(me)])],[u(fun_pre)][name([pmatch(%1)])] got this round! The answer is '[last([u(i_quest_[u(i_curr_quest)])],|)]'.,1)];[set(me,i_secs:[secs()])];[set(me,i_last_answ_corr:1)],)],)],)]
&CMD_INIT [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!init":th [set(me,i_score_[pmatch(%1)]:0)];th [pemit([pmatch(%1)],[u(fun_pre)]Your scores have been re-initialized. You may now participate on the Trivia Channel.)]
&CMD_HELP [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!help":@pemit [pmatch(%1)]=[u(fun_bcenter,[u(i_name)] [ansi(yh,Help System)],80,=)]%rThe [u(i_name)] Bot is your run of the mill Trivia Bot custom built to run on pennmush systems. Much like any other Trivia Bot, it relies on correct answers being sent through the trivia channel to be valid. All answers have to be spelled correctly or else they won't be viewed as valid answers.%rCommands:%r[ansi(g,!init)] ~ (Re)Initialize yourself in the trivia system.%r[ansi(g,!about)] ~ Display a general about page about this bot.%r[ansi(g,!start)] ~ Restarts the bot from a stopped state. (Admin only command)%r[ansi(g,!stop)] ~ Stops the bot. (Admin only command)%r[u(fun_bfooter,80,=)]
&CMD_ABOUT [v(SVC`T9163a493bcfdb322222b)]=^<*> * says, "!about":@pemit [pmatch(%1)]=[u(fun_bcenter,[u(i_name)] [ansi(yh,About Page)],80,=)]%rWelcome to [u(i_name)] version [ansi(y,[u(i_ver)])]. I have been created by [ansi(xh,[u(author)])] for use on any pennmush enabled game. Please do not plagiarize my work and enjoy the game.%r[u(fun_bfooter,80,=)]
&AUTHOR [v(SVC`T9163a493bcfdb322222b)]=Teal@M*U*S*H, Antea@ProjectCarthage, Vchat20/cr08 on the web.
@set [v(SVC`T9163a493bcfdb322222b)]/DESCRIBE=no_command visual prefixmatch public nearby
@@
@@ Triggering all startups, oncreates, onupdates.
@@