06 July 2012

time bomb

on *:text:!timebomb *:#:{
  if ($2 !ison #) {    
    msg $chan Who is $2- ?
  }
  else {
    set %timebomb.nick $2
    set %timebomb.wire $rand(1,3)
    set %timebomb.play 1
    describe $chan Gives %timebomb.nick the bomb.  
    set %timebomb.color.1 $rtbomb
    set %timebomb.color.2 $rtbomb
    set %timebomb.color.3 $rtbomb
    if (%timebomb.color.1 == %timebomb.color2) { set %timebomb.color1 $rtbomb }
    if (%timebomb.color.1 == %timebomb.color1) { set %timebomb.color3 $rtbomb }
    if (%timebomb.color.3 == %timebomb.color1) { set %timebomb.color3 $rtbomb }


    set %timebomb.win %timebomb.color. [ $+ [ $rand(1,3) ] ]
    msg $chan %timebomb.nick $+ : There are 3 wires. %timebomb.color.1 , %timebomb.color.2 and %timebomb.color.3
    msg $chan %timebomb.nick $+ : Use !cutwire <color> to defuse the bomb. (You have 15 seconds)
    echo -at [TimeBomb Debug] nick= $+ %timebomb.nick wire= $+ $timebomb.wire color= $+ %timebomb.win
    timerbomb 1 15 kick $chan %timebomb.nick 4 BOOM!

  }
}
on *:text:!cutwire *:#:{
  if ($nick == %timebomb.nick) {
    if (%timebomb.play != 1) {
    msg $chan There is no bomb in the channel! }
    else {
      if ($2 == %timebomb.win) { msg $chan $nick has defused the bomb! | unset %timebomb.* | timerbomb off  }
      else { msg $chan 4 BOOM! | kick $chan %timebomb.nick 4 BOOM! | unset %timebomb.*  | timerbomb off }
      else { msg $chan You don't have a bomb YET! }
    }
  }
}

alias -l rtbomb {
  var %tcc red blue yellow orange pink purple cyan brown black gray white green
  return $gettok(%tcc,$rand(1,10),32)
}




triggers
!timebomb
!cutwire

No comments: