All pastes #240288 Raw Edit

Stuff

public text v1 · immutable
·published 2006-11-05 18:21 UTC
rendered paste body
on *:TEXT:!cookie*:#: {
  if ($2 == $null) { msg $chan Unknown cookie command. Type !cookie help to get a list of available cookie commands } 
  elseif ($2 == help) { notice $nick Cookie commands: !cookie fill - !cookie eat <number> - !cookie add <number> - !cookie guess start - !cookie guess stop - !cookie guess score - !cookie stats }
  elseif ($2 == stats) {
    msg $chan Last person to fill cookie jar: %cookiefiller
    .timer 1 1 msg $chan Last person to eat cookie: $+(,%cookieeater,)
    .timer 1 2 msg $chan Last person to add cookie: $+(,%cookieadder,)
    .timer 1 3 msg $chan Cookies left in cookie jar: $+(,%cookiejar,)
    .timer 1 4 msg $chan Type !cookie help to get a list of cookie commands.
  }
  elseif ($2 == guess) && ($3 == score) && (% [ $+ [ cookiescore [ $+ [ . [ $+ [ $nick ] ] ] ] ] ] == $null) { 
    set % [ $+ [ cookiescore [ $+ [ . [ $+ [ $nick ] ] ] ] ] ] 0
    msg $chan $+(,$nick,) $+ : Your current cookie guessing score is $+(,% [ $+ [ cookiescore [ $+ [ . [ $+ [ $nick ] ] ] ] ] ],) $+ . 
  }
  elseif ($2 == guess) && ($3 == score) { msg $chan $+(,$nick,) $+ : Your current cookie guessing score is $+(,% [ $+ [ cookiescore [ $+ [ . [ $+ [ $nick ] ] ] ] ] ],) $+ . }
  elseif ($2 == guess) && ($3 == stop) && (%cookieguess != ON) { msg $chan There is no cookie guessing game in progress $+(,$nick,) $+ . }  
  elseif ($2 == guess) && ($3 == stop) { 
    set %cookieguess OFF
    set %cookiejar 0
    msg $chan Cookie Guessing Game has stopped. The cookie jar has been emptied.
  }
  elseif ($2 == guess) && ($3 == start) && (%cookieguess == ON) { msg $chan Cookie Guessing Game is already going $+(,$nick,) $+ . }
  elseif ($2 == guess) && ($3 == start) {
    set %cookieguess ON
    set %cookiejar $rand(1,1000)
    msg $chan Cookie Guessing Game has started.
    .timer 1 1 msg $chan Type !cookie guess <number> to guess how many cookies are in the cookie jar.
  }
  elseif ($2 == guess) && ($3 !isnum) && (%cookieguess != ON) { msg $chan There is no cookie guessing game in progress $+(,$nick,) $+ . }
  elseif ($2 == guess) && ($3 isnum) && ($3 > %cookiejar) && (%cookieguess != ON) { msg $chan There is no cookie guessing game in progress $+(,$nick,) $+ . }
  elseif ($2 == guess) && ($3 isnum) && ($3 < %cookiejar) && (%cookieguess != ON) { msg $chan There is no cookie guessing game in progress $+(,$nick,) $+ . }
  elseif ($2 == guess) && ($3 isnum) && ($3 == %cookiejar) && (%cookieguess != ON) { msg $chan There is no cookie guessing game in progress $+(,$nick,) $+ . }
  elseif ($2 == guess) && ($3 !isnum) { msg $chan You need to specify the number of cookies you think are in the jar $+(,$nick,) $+ . }
  elseif ($2 == guess) && ($3 isnum) && ($3 > %cookiejar) && (%cookieguess == ON) { msg $chan Incorrect! Try a lower number $+(,$nick,) $+ . }
  elseif ($2 == guess) && ($3 isnum) && ($3 < %cookiejar) && (%cookieguess == ON) { msg $chan Incorrect! Try a higher number $+(,$nick,) $+ . }
  elseif ($2 == guess) && ($3 isnum) && ($3 == %cookiejar) && (%cookieguess == ON) { 
    set %cookiejar 0
    set %cookieguess OFF
    inc % [ $+ [ cookiescore [ $+ [ . [ $+ [ $nick ] ] ] ] ] ] 1
    msg $chan Yes! $+(,$nick,) got the answer correct with $+(,$3,) and is awarded 1 point.
    .timer 1 1 msg $chan The cookie jar has been emptied. Type !cookie guess start to start anew!
  }
  elseif ($2 == fill) && (%cookieguess == ON) { msg $chan You cannot fill the cookie jar while the cookie guessing game is in progress $+(,$nick,) $+ . }
  elseif ($2 == fill) && (%cookiejar == 1000) { msg $chan The cookie jar is already full $+(,$nick,) $+ . There are $+(,%cookiejar,) cookies in it. }
  elseif ($2 == fill) {
    set %cookiejar 1000
    set %cookiefiller $nick
    msg $chan The cookie jar has been filled by $+(,$nick,) $+ . There are now $+(,%cookiejar,) cookies in it.
  }
  elseif ($2 == eat) && (%cookieguess == ON) { msg $chan You cannot eat from the cookie jar while the cookie guessing game is in progress $+(,$nick,) $+ . }
  elseif ($2 == eat) && ($3 !isnum) { msg $chan You need to specify a number of cookies you want to eat $+(,$nick,) $+ . }
  elseif ($2 == eat) && ($left($3,1) == 0) { msg $chan You can't eat 0 cookies from the jar $+(,$nick,) $+ . }
  elseif ($2 == eat) && ($3 isnum) && ($calc(%cookiejar - $3) < 0) { msg $chan There aren't enough cookies for you to eat that much $+(,$nick,) $+ . }
  elseif ($2 == eat) && ($3 isnum) && ($calc(%cookiejar - $3) >= 0) {
    dec %cookiejar $3
    set %cookieeater $nick
    msg $chan Who stole the cookie(s) from the cookie jar?!
    .timer 1 1 msg $chan $+(,$nick,) stole the cookie(s) from the cookie jar! There are now $+(,%cookiejar,) cookies left.
  }
  elseif ($2 == add) && (%cookieguess == ON) { msg $chan You cannot add to the cookie jar while the cookie guessing game is in progress $+(,$nick,) $+ . }
  elseif ($2 == add) && ($3 !isnum) { msg $chan You need to specify a number of cookies you want to add to the jar $+(,$nick,) $+ . }
  elseif ($2 == add) && ($left($3,1) == 0) { msg $chan You can't add 0 cookies to the jar $+(,$nick,) $+ . }
  elseif ($2 == add) && ($3 isnum) && ($calc(%cookiejar + $3) <= 1000) {
    inc %cookiejar $3
    set %cookieadder $nick
    msg $chan $+(,$nick,) added $+(,$3,) cookie(s) to the cookie jar. There are now $+(,%cookiejar,) cookies in it.
  }
  elseif ($2 == add) && ($3 isnum) && ($calc(%cookiejar + $3) > 1000) { msg $chan The cookie jar can't hold that many cookies $+(,$nick,) $+ . }
  else { msg $chan Unknown cookie command. Type !cookie help to get a list of available cookie commands }
}


---


ROLL GAME:


on *:TEXT:!roll*:#: {
  if ($2- == $null) {  
    set %dice 1
    set %sides 6
    %roll = $rand(1,%sides)
    msg # Roll 1: %roll
  }
  else {
    set %dice $2
    set %sides $3
    set %i 0
    set %total 0
    set %average 0
    if ($2 !isnum) || ($3 !isnum) { 
      msg # INVALID PARAMETERS!      
      halt

    }
    if (%dice <= 0) || %sides <= 0) { 
      msg # INVALID PARAMETERS!      
      halt

    }
    while (%i < %dice) {
      inc %i 1
      %roll = $rand(1,%sides)
      msg # Roll %i $+ : %roll
      %total = $calc(%total + %roll)
    }
    msg # Total: %total
    %average = $calc(%total / %dice)
    msg # Average: %average
  }
}