All pastes #593939 Raw Edit

Unnamed

public text v1 · immutable
#593939 ·published 2007-06-28 16:54 UTC
rendered paste body
on *:TEXT:!setpoll*:#:{ if ($nick isop $chan) || ($nick ishop $chan) || ($nick isvo $chan) { 
    set %polly on
    set %pollquestion $$2-
    set %pollchan $chan
    set %pollnick $nick
    set %pollpeople 0
    set %polltime 60
    set %pollyes 0
    set %pollno 0
    msg %pollchan Poll started by %pollnick $+ . %pollquestion $+ ? Type !yes to answer yes and !no to answer no.
    timer 1 30 msg $chan There are 30 Seconds left of the poll and %pollpeople people have voted so far.
    timer 1 60 msg $chan Poll results are: %pollyes Yes's and %pollno No's.
    unset pollnick.*  
  }
}

on *:TEXT:!votes:#:{ if (%polly != on) { notice $nick There is no poll currently on! | halt } 
  msg $chan %pollyes people have said yes. 
  msg $chan %pollno people have said no.
msg $chan %pollpeople have voted so far. }

on *:text:!yes*:#: {
  if (%polly == on) {
    if (%pollnick. $+ $nick != yes) {
      set %pollnick. $+ $nick yes 
      inc %pollyes 1
      inc %pollpeople 1
      notice $nick Thank you $nick for your vote.
    }
    else {
      notice $nick Please refrain from voting twice.
    }
  }
}
on *:text:!no*:#: {
  if (%polly == on) {
    set %pollnick. $+ $nick  no
    if (%pollnick. $+ $nick != no) {
      inc %pollno 1
      inc %pollpeople 1
      notice $nick Thank you $nick for you vote.
    }
    else{
    notice $nick Please refrain from voting twice..
  }
}

Explanation -- 
A user says !setpoll with the question and starts the two timers.
When user votes yes/no it gets counted correctly. When a user says !votes it replys with the total number of votes + people voted.
However at the 30 and 60 second timer, the timers just message the channel with to values which are stated at the start.

So the problem is -- that the timers get evaluated before they do what theyre supposed to.

Oh and another thing, you can vote more then once =/