Trihan

Madilbs

Sep 16th, 2011
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 5.26 KB | None | 0 0
  1. on *:TEXT:!madlib:%madchan: {
  2.   if ($GetD(SETTINGS,GameStatus) != ON) {
  3.     msg $chan $nick has started a new story! When prompted, PM me with !submit {word} to fill the current word request. If you're the submitter of a word, you can also PM !replace {wordnumber} {newword}. To stop the game, type !madend in channel.
  4.     $SetD(SETTINGS,Story,$rand(1,$ini($+($scriptdir,stories.ini),0)))
  5.     $SetD(SETTINGS,Words,$readini($+($scriptdir,stories.ini),story $+ $GetD(SETTINGS,Story),Words))
  6.     $SetD(SETTINGS,NumWords,$numtok($GetD(SETTINGS,Words),44))
  7.     $SetD(SETTINGS,SubWords,$str(word|,$calc($GetD(SETTINGS,NumWords) - 1)) $+ word)
  8.     $SetD(SETTINGS,CurrentWord,$rand(1,$numtok($GetD(SETTINGS,Words),44)))
  9.     $SetD(SETTINGS,GameStatus,ON)
  10.     msg $chan Word $current_word $+ :4 $GetWord($GetD(SETTINGS,CurrentWord)) $+ .
  11.   }
  12.   else {
  13.     msg $chan A game is already active. I'm looking for word $current_word $+ : 4 $+ $GetWord($GetD(SETTINGS,CurrentWord)) $+ .
  14.   }
  15. }
  16. on *:TEXT:!madend:%madchan: {
  17.   if ($GetD(SETTINGS,GameStatus) == ON) {
  18.     msg $chan $nick has ended the game!
  19.     madlib_end
  20.   }
  21.   else {
  22.     msg $chan There isn't a game on to end! Type !madlib to start one.
  23.   }
  24. }
  25. on *:TEXT:!submit *:?: {
  26.   if ($GetD(SETTINGS,GameStatus) == ON) {
  27.     if (!$GetD(SETTINGS,NumSubWords) || ($GetD(SETTINGS,NumSubWords) < $GetD(SETTINGS,NumWords))) {
  28.       if (!$timer(madlib)) {
  29.         if ($len($$2-) <= 20) {
  30.           msg %madchan Word $current_word has been submitted by $nick $+ .
  31.           $SetD(SETTINGS,SubWords,$puttok($GetD(SETTINGS,SubWords),$strip($$2-),$GetIndex($GetD(SETTINGS,CurrentWord)),124))
  32.           $SetD(SETTINGS,NumSubWords,$calc($GetD(SETTINGS,NumSubWords) + 1))
  33.         $SetD(SETTINGS,Submitter,$instok($GetD(SETTINGS,Submitter),$nick,$current_word,124))
  34.           if (!$GetD(SETTINGS,NumSubWords) || ($GetD(SETTINGS,NumSubWords) < $GetD(SETTINGS,NumWords))) {
  35.             $SetD(SETTINGS,Words,$deltok($GetD(SETTINGS,Words),$GetD(SETTINGS,CurrentWord),44))
  36.           $SetD(SETTINGS,CurrentWord,$rand(1,$numtok($GetD(SETTINGS,Words),44)))
  37.           timermadlib 1 3 msg %madchan Word $current_word $+ : 4 $+ $GetWord($GetD(SETTINGS,CurrentWord)) $+ .
  38.           }
  39.           else {
  40.             msg %madchan You're done! Type !finish to see your masterpiece.
  41.           timermadlib off
  42.           }
  43.         }
  44.         else {
  45.           notice $nick Please keep submissions to 20 characters or less.
  46.         }
  47.       }
  48.           else {
  49.           notice $nick Please wait $timer(madlib).secs seconds before submitting another word.
  50.         }
  51.     }
  52.     else {
  53.       notice $nick You're already done! Type !finish to see your masterpiece.
  54.     }
  55.   }
  56.   else {
  57.     notice $nick There isn't a game on right now. Type !madlib to start one.
  58.   }
  59. }
  60. on *:TEXT:!replace *:?: {
  61.   if ($GetD(SETTINGS,GameStatus) == ON) {
  62.     if ($nick == $gettok($GetD(SETTINGS,Submitter),$$2,124)) {
  63.       if ($$3- != $gettok($GetD(SETTINGS,SubWords),$$2,124)) {
  64.         if ($$3- <= $GetD(SETTINGS,NumSubWords)) {
  65.           if ($len($$3-) <= 20) {
  66.             msg %madchan $nick has replaced word $$2 $+ .
  67.             $SetD(SETTINGS,SubWords,$puttok($GetD(SETTINGS,SubWords),$strip($$3-),$$2,124))
  68.           }
  69.           else {
  70.             notice $nick Please keep submissions to 20 characters or less.
  71.           }
  72.         }
  73.         else {
  74.           notice $nick You haven't submitted that many words yet.
  75.         }
  76.       }
  77.       else {
  78.         notice $nick Word $$2 is already $$3- $+ .
  79.       }
  80.     }
  81.     else {
  82.       notice $nick Only $gettok($GetD(SETTINGS,Submitter),$$2,124) may replace that word.
  83.     }
  84.   }
  85.   else {
  86.     notice $nick There isn't a game on right now. Type !madlib to start one.
  87.   }
  88. }
  89. on *:TEXT:!finish:%madchan: {
  90.   if ($GetD(SETTINGS,GameStatus) == ON) {
  91.     if ($GetD(SETTINGS,NumSubWords) == $GetD(SETTINGS,NumWords)) {
  92.       msg $chan Alright! Let's see the story we created:
  93.       msg $chan 12,15 $+ $readini($+($scriptdir,stories.ini),story $+ $GetD(SETTINGS,Story),name) $+ 
  94.       $GetS(story $+ $GetD(SETTINGS,Story))
  95.       msg $chan Wasn't that fun! Feel free to type !madlib and make another story!
  96.       madlib_end
  97.     }
  98.     else {
  99.       msg $chan But you haven't finished yet! I still need word $current_word $+ : 4 $+ $GetWord($GetD(SETTINGS,CurrentWord)) $+ .
  100.     }
  101.   }
  102.   else {
  103.     msg $chan There isn't a game on right now. Type !madlib to start one.
  104.   }
  105. }
  106. alias GetD {
  107.   if ($readini($+($scriptdir,maddata.ini),$$1,$2)) {
  108.     return $v1
  109.   }
  110.   else {
  111.     return $null
  112.   }
  113. }
  114. alias GetWord {
  115.   return $right($gettok($GetD(SETTINGS,Words),$$1,44),-2)
  116. }
  117. alias GetIndex {
  118.     return $left($gettok($GetD(SETTINGS,Words),$$1,44),2)
  119.   }
  120. alias GetS {
  121.   var %i = 1
  122.   while ($readini($+($scriptdir,stories.ini),$$1,$+(story,%i))) {
  123.     msg $chan 12,15 $+ $v1 $+ 
  124.     inc %i
  125.   }
  126.   return
  127. }
  128. alias SetD {
  129.   writeini $+(",$scriptdir,maddata.ini") $$1 $$2 $$3-
  130. }
  131. alias isvowel {
  132.   if ($$1 == a || $$1 == e || $$1 == i || $$1 == o || $$1 == u) {
  133.     return $true
  134.   }
  135.   else {
  136.     return $false
  137.   }
  138. }
  139.     alias Get_SubWord {
  140.     return $gettok($GetD(SETTINGS,SubWords),$$1,124)
  141.   }
  142. alias current_word {
  143.   return $calc($GetD(SETTINGS,NumSubWords) + 1)
  144. }
  145. alias madlib_end {
  146.   remini $+($scriptdir,maddata.ini) SETTINGS
  147. }
Advertisement
Add Comment
Please, Sign In to add comment