Charmander

witty by Charmander

Jul 29th, 2011
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.39 KB | None | 0 0
  1. ;Witty Game
  2. ;By Charmander
  3. ;For Firecape
  4. on $*:text:/^([!@.]witty)$/i:#: {
  5.   if (%witty != on) {
  6.     set %chan #
  7.     set %witty on
  8.     coconuts
  9.   }
  10. }
  11. alias coconuts {
  12.   msg %chan A new round begins!
  13.   msg %chan Get ready...
  14.   set %prompt $read(prompts.txt)
  15.   msg %chan Complete this sentence: %prompt
  16.   msg %chan You have 60 seconds to come up with an answer!
  17.   set %stage answer
  18.   .timer 1 60 endanswer
  19.   .timer 1 30 msg %chan Hurry up! 30 seconds left!
  20. }
  21. on *:text:*:?: {
  22.   if (%stage == answer) {
  23.     if ($nick !isin %answered) {
  24.       inc %number
  25.       set %answer [ $+ [ %number ] ] $nick $1-
  26.       msg %chan $+([,%number,]) was submitted.
  27.       msg $nick The answer $+(04,$1-,) was submitted.
  28.       set %answered %answered $nick
  29.     }
  30.     else {
  31.       set %answer [ $+ [ %number ] ] $nick $1-
  32.       msg $nick Your submission was changed to $+(04,$1-,,.)
  33.     }
  34.   }
  35.   if (%stage == vote) {
  36.     tokenize 32 %answer [ $+ [ $1- ] ]
  37.     if ($nick !isin %voted && $nick isin %answered && $1- isnum && $1- <= %number && $2 != $nick) {
  38.       set %voted %voted $nick
  39.       set %votes [ $+ [ $1 ] ] %votes [ $+ [ $1 ] ] $nick
  40.       msg $nick You voted for $+(04,$1,!)
  41.     }
  42.   }
  43. }
  44. alias endanswer {
  45.   if (%number >= 2) {
  46.     msg %chan Time is up...
  47.     msg %chan %prompt
  48.     set %count 1
  49.     while (%count <= %number) {
  50.       tokenize 32 %answer [ $+ [ %count ] ]
  51.       msg %chan $+([,%count,]) $2-
  52.       inc %count
  53.     }
  54.     set %stage vote
  55.     msg %chan Please start voting for the best candidate! You have 60 seconds to vote!
  56.     .timer 1 60 endvote
  57.     .timer 1 30 msg %chan Hurry up! Only 30 seconds left to vote!
  58.   }
  59.   else {
  60.     msg %chan Two people required to play witty, game over.
  61.     unset %answer1
  62.     unset %witty
  63.     unset %prompt
  64.     unset %number
  65.     unset %chan
  66.     unset %stage
  67.     unset %answered
  68.   }
  69. }
  70. alias endvote {
  71.   unset %stage
  72.   msg %chan Voting is over.
  73.   msg %chan %prompt
  74.   set %count 1
  75.   while (%count <= %number) {
  76.     tokenize 32 %answer [ $+ [ %count ] ]
  77.     set %points [ $+ [ $1 ] ] $iif(%points [ $+ [ $1 ] ],$calc($numtok(%votes [ $+ [ %count ] ],32) + %points [ $+ [ $1 ] ]),$numtok(%votes [ $+ [ %count ] ],32))
  78.     msg %chan $+([,%count,],[,$1,]) $2- : $numtok(%votes [ $+ [ %count ] ],32) votes by $iif(%votes [ $+ [ %count] ],$replace(%votes [ $+ [ %count ] ],$chr(32),$chr(44)),No one.)
  79.     inc %count
  80.   }
  81.   coconuts
  82. }
Advertisement
Add Comment
Please, Sign In to add comment