All pastes #57122 Raw Edit

poll incomplete

public text v1 · immutable
#57122 ·published 2006-05-19 14:28 UTC
rendered paste body
on *:TEXT:!poll*:#:{
  if (%p.on != $null) { 
    msg $chan Current Poll: %p.q 
    msg $chan Vote by typing !yes or !no
    halt
  }
  else {
    if ($nick isop $chan) || ($nick ishop $chan) {
      set %p.on 1
      set %p.chan $chan
      set %p.nick $nick
      set %p.q $2-
      msg $chan %p.q <Vote by typing !yes or !no>
      enable #pollison
    }
  }
}
#pollison off
on *:TEXT:!yes:#:{
  if ($chan == %p.chan) {
    echo right channel
    if (%p.yes == $null) {
      set %p.yes 1
    }
    else {
      inc %p.yes 1
    }
  }
}
on *:TEXT:!no:#:{
  if ($chan == %p.chan) {
    echo right channel
    if (%p.no == $null) {
      set %p.no 1
    }
    else {
      inc %p.no 1
    }
  }
}
on *:TEXT:!end:%p.chan:{
  if ($nick ison $chan) {
    msg $chan Poll ended: %p.yes said yes .::. %p.no said no ( $+ $round($calc(100 * (%p.yes / ( %p.yes + %p.no ) ) ),2) $+ % Approval)
    unset %p.* 
    disable #pollison 
  }
}
#pollison end