Vote SCript

By LizardKing on Aug 14, 2008

Alright, so I was bored...

!Vote option1 option2 (I like to add the question after, makes more sense.)
ex. !vote Me You (Who is cooler?)

!Vote1 (Votes for option1)
!Vote2 (Votes for option2)

!Vr (Ends the voting period and tells the results.)

A very simple script, seeing as how I am new at scripting. Please don't tear me apart >.<
Edit: Added it so 1 person can only vote once.

on *:text:!vote *:#: {
  if (%vote != on ) {
    set %vote1 $2
    set %vote2 $3
    set %vote on
    set %vot $nick
    set %v1 $2
    set %v2 $3
    notice $nick To end and view the results type: !vr
    msg $chan 14 $+ $nick has left it up to you to decide/vote between $2 or $3 $+ . You have 5 minutes to vote.
    msg $chan 14 To vote for $2 type: !vote1. To vote for $3 type: !vote2.
    halt
  }
  else {
    notice $nick A tally is already taking place, please wait.
    halt
  }
}
on *:text:!vote1:#: {
  if (%vote != on ) {
    notice $nick No one has started a vote.
    halt
  }
  elseif (%vot == $nick ) {
    notice $nick You cannot vote in your own tally :P
    halt
  }
  elseif (%vot* == $nick ) {
    notice $nick You have already voted.
    halt
  }
  else {
    inc %vote.1 1
    notice $nick Your vote has been tallied for %v1
    halt
  }
}
on *:text:!vote2:#: {
  if (%vote != on ) {
    notice $nick No one has started a vote.
    halt
  }
  elseif (%vot == $nick ) {
    notice $nick You cannot vote in your own tally :P
    halt
  }
  else {
    inc %vote.2 1
    notice $nick Your vote has been tallied for %v2 $+ (Please do not vote more than once).
    halt
  }
}
on *:text:!vr:#:{
  if (%vot == $nick ) {
    msg $chan 14There were %vote.1 votes for %v1 $+ .
    msg $chan 14And there were %vote.2 votes for %v2 $+ .
    msg $chan 14Hope this helped ^.^
    set %vote.1 0
    set %vote.2 0
    unset %vote1 $2
    unset %vote2 $3
    unset %vote on
    unset %vot $nick
    unset %v1 $2
    unset %v2 $3
    halt
  }
  else (
  notice $nick You did not start it, so you cannot view the results or end it.
  halt
}

Comments

Sign in to comment.
Blitzjager   -  Sep 27, 2008

I haven't tried it but from looking you say that there is 5 minutes to vote but I didn't see any timers or anything. Maybe make it so you can set the amount of time yourself.

 Respond  
Claus999   -  Sep 27, 2008

i see one problem with this... yeah it makes a vote and it mostly works but i did a test where i used a secondary IRC for the script since u c annot use commands from the script on yourself heh and i did !vote1 and it said i voted and then i did !vr and this is what i got:
-02:06- <@VoteBot> There were votes for test1.
-02:06- <@VoteBot> And there were votes for test2.
-02:06- <@VoteBot> Hope this helped ^.^

as u can see it dosnt show anything about how many votes on what option.. its nice this vote script just needs the last few things ;)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.