Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on *:TEXT:!madlib:%madchan: {
- if ($GetD(SETTINGS,GameStatus) != ON) {
- 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.
- $SetD(SETTINGS,Story,$rand(1,$ini($+($scriptdir,stories.ini),0)))
- $SetD(SETTINGS,Words,$readini($+($scriptdir,stories.ini),story $+ $GetD(SETTINGS,Story),Words))
- $SetD(SETTINGS,NumWords,$numtok($GetD(SETTINGS,Words),44))
- $SetD(SETTINGS,SubWords,$str(word|,$calc($GetD(SETTINGS,NumWords) - 1)) $+ word)
- $SetD(SETTINGS,CurrentWord,$rand(1,$numtok($GetD(SETTINGS,Words),44)))
- $SetD(SETTINGS,GameStatus,ON)
- msg $chan Word $current_word $+ :4 $GetWord($GetD(SETTINGS,CurrentWord)) $+ .
- }
- else {
- msg $chan A game is already active. I'm looking for word $current_word $+ : 4 $+ $GetWord($GetD(SETTINGS,CurrentWord)) $+ .
- }
- }
- on *:TEXT:!madend:%madchan: {
- if ($GetD(SETTINGS,GameStatus) == ON) {
- msg $chan $nick has ended the game!
- madlib_end
- }
- else {
- msg $chan There isn't a game on to end! Type !madlib to start one.
- }
- }
- on *:TEXT:!submit *:?: {
- if ($GetD(SETTINGS,GameStatus) == ON) {
- if (!$GetD(SETTINGS,NumSubWords) || ($GetD(SETTINGS,NumSubWords) < $GetD(SETTINGS,NumWords))) {
- if (!$timer(madlib)) {
- if ($len($$2-) <= 20) {
- msg %madchan Word $current_word has been submitted by $nick $+ .
- $SetD(SETTINGS,SubWords,$puttok($GetD(SETTINGS,SubWords),$strip($$2-),$GetIndex($GetD(SETTINGS,CurrentWord)),124))
- $SetD(SETTINGS,NumSubWords,$calc($GetD(SETTINGS,NumSubWords) + 1))
- $SetD(SETTINGS,Submitter,$instok($GetD(SETTINGS,Submitter),$nick,$current_word,124))
- if (!$GetD(SETTINGS,NumSubWords) || ($GetD(SETTINGS,NumSubWords) < $GetD(SETTINGS,NumWords))) {
- $SetD(SETTINGS,Words,$deltok($GetD(SETTINGS,Words),$GetD(SETTINGS,CurrentWord),44))
- $SetD(SETTINGS,CurrentWord,$rand(1,$numtok($GetD(SETTINGS,Words),44)))
- timermadlib 1 3 msg %madchan Word $current_word $+ : 4 $+ $GetWord($GetD(SETTINGS,CurrentWord)) $+ .
- }
- else {
- msg %madchan You're done! Type !finish to see your masterpiece.
- timermadlib off
- }
- }
- else {
- notice $nick Please keep submissions to 20 characters or less.
- }
- }
- else {
- notice $nick Please wait $timer(madlib).secs seconds before submitting another word.
- }
- }
- else {
- notice $nick You're already done! Type !finish to see your masterpiece.
- }
- }
- else {
- notice $nick There isn't a game on right now. Type !madlib to start one.
- }
- }
- on *:TEXT:!replace *:?: {
- if ($GetD(SETTINGS,GameStatus) == ON) {
- if ($nick == $gettok($GetD(SETTINGS,Submitter),$$2,124)) {
- if ($$3- != $gettok($GetD(SETTINGS,SubWords),$$2,124)) {
- if ($$3- <= $GetD(SETTINGS,NumSubWords)) {
- if ($len($$3-) <= 20) {
- msg %madchan $nick has replaced word $$2 $+ .
- $SetD(SETTINGS,SubWords,$puttok($GetD(SETTINGS,SubWords),$strip($$3-),$$2,124))
- }
- else {
- notice $nick Please keep submissions to 20 characters or less.
- }
- }
- else {
- notice $nick You haven't submitted that many words yet.
- }
- }
- else {
- notice $nick Word $$2 is already $$3- $+ .
- }
- }
- else {
- notice $nick Only $gettok($GetD(SETTINGS,Submitter),$$2,124) may replace that word.
- }
- }
- else {
- notice $nick There isn't a game on right now. Type !madlib to start one.
- }
- }
- on *:TEXT:!finish:%madchan: {
- if ($GetD(SETTINGS,GameStatus) == ON) {
- if ($GetD(SETTINGS,NumSubWords) == $GetD(SETTINGS,NumWords)) {
- msg $chan Alright! Let's see the story we created:
- msg $chan 12,15 $+ $readini($+($scriptdir,stories.ini),story $+ $GetD(SETTINGS,Story),name) $+
- $GetS(story $+ $GetD(SETTINGS,Story))
- msg $chan Wasn't that fun! Feel free to type !madlib and make another story!
- madlib_end
- }
- else {
- msg $chan But you haven't finished yet! I still need word $current_word $+ : 4 $+ $GetWord($GetD(SETTINGS,CurrentWord)) $+ .
- }
- }
- else {
- msg $chan There isn't a game on right now. Type !madlib to start one.
- }
- }
- alias GetD {
- if ($readini($+($scriptdir,maddata.ini),$$1,$2)) {
- return $v1
- }
- else {
- return $null
- }
- }
- alias GetWord {
- return $right($gettok($GetD(SETTINGS,Words),$$1,44),-2)
- }
- alias GetIndex {
- return $left($gettok($GetD(SETTINGS,Words),$$1,44),2)
- }
- alias GetS {
- var %i = 1
- while ($readini($+($scriptdir,stories.ini),$$1,$+(story,%i))) {
- msg $chan 12,15 $+ $v1 $+
- inc %i
- }
- return
- }
- alias SetD {
- writeini $+(",$scriptdir,maddata.ini") $$1 $$2 $$3-
- }
- alias isvowel {
- if ($$1 == a || $$1 == e || $$1 == i || $$1 == o || $$1 == u) {
- return $true
- }
- else {
- return $false
- }
- }
- alias Get_SubWord {
- return $gettok($GetD(SETTINGS,SubWords),$$1,124)
- }
- alias current_word {
- return $calc($GetD(SETTINGS,NumSubWords) + 1)
- }
- alias madlib_end {
- remini $+($scriptdir,maddata.ini) SETTINGS
- }
Advertisement
Add Comment
Please, Sign In to add comment