Simple Vote / Poll System v1.0

By illhawkthat on Jul 12, 2014

Simple Vote / Poll System v1.0

  • Made by nick1
  • Last edit July 13 2014
  • For help/setup type /newpoll in mIRC

USAGE:

Used to quickly poll a channel between two different options (Yes / No, Orange or Red, etc.)

DIRECTIONS:

  • Copy entire code and paste into remote section of a new script (Hit alt+r, File<New, Paste in the copied code, File<Save as "youtube.ini")
  • Please view the help/setup information found by typing /newpoll into mIRC
  • Vote using .vote

INFO:

  • Originally created for #worldcup on irc.rizon.net

--Let me know when its broken//what you want changed.


--Feedback greatly appreciated

;Simple Vote / Poll System v1.0
;Made by nick1
;Last edit July 13 2014
;For help/setup type /newpoll in mIRC
;World cup version http://pastebin.com/95TBu3Q8

alias newpoll {
  unset %vote*
  set %votechan $?="Chan for poll? - Include #"
  set %vote_title $input(Please enter the poll title,eio,Create a new poll)
  set %vote1_name $?="Option 1"
  set %vote2_name $?="Option 2"
  set %vote1 0
  set %vote2 0
  set %poll on
  msg %votechan 4New poll: %vote_title 04 $+ %vote1_name or %vote2_name $+ ? - Vote using .vote $+(<,%vote1_name,|,%vote2_name,>)
}

on $*:text:/^[!.](vote|v)(\s|$)/Si:%votechan: {
  if ($($+(%,botflood.,$nick),2)) {
    if ($($+(%,botflood.,$nick),2) >= 50) {
      ignore -u60 $address($nick,2)
      msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
      halt
    }
    elseif ($($+(%,botflood.,$nick),2) >= 40) {
      msg $chan $+($nick,$chr(44)) Please do not flood the bot.
      inc -z $+(%,botflood.,$nick) 20
      halt
    }
    else { inc -z $+(%,botflood.,$nick) 25 }
  }
  else { inc -z $+(%,botflood.,$nick) 25 }
  if (%poll == off) {
    if (%pollflood != true) {
      msg $chan 4Poll Closed - Results: $poll
      set -u30 %pollflood true
    }
    halt
  }
  if ($istok(%voted,$address($nick,2),44)) {
    msg $chan Sorry $nick $+ , you have already voted on this match.
    halt
  }
  else {
    if (($2 isin %vote1_name) || ($2 isin %vote2_name) || ($2 == 1) || ($2 == 2)) {
      if ((($2 isin %vote1_name) || ($2 == 1)) && ($2 != $left(%vote2_name,1))) { inc %vote1 }
      elseif (($2 isin %vote2_name) || ($2 == 2)) { inc %vote2 }
      set %voted $addtok(%voted,$address($nick,2),44)
      msg $chan $poll
    }
    else {
      msg $chan $nick $+ , try .vote $+(<,%vote1_name,|,%vote2_name,>)
    }
  }
}
on *:input:%votechan: {
  if (($1 == .vote) || ($1 == !vote)) {
    if (($2 isin %vote1_name) || ($2 isin %vote2_name)) {
      if ($2 isin %vote1_name) { inc %vote1 }
      elseif ($2 isin %vote2_name) { inc %vote2 }
      set %voted $addtok(%voted,$address($nick,2),44)
      .timer -m 1 100 msg $chan $poll
    }
  }
}
on $*:text:/^[!.](poll)(\s|$)/Si:%votechan: {
  if ($($+(%,botflood.,$nick),2)) {
    if ($($+(%,botflood.,$nick),2) >= 50) {
      ignore -u60 $address($nick,2)
      msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
      halt
    }
    elseif ($($+(%,botflood.,$nick),2) >= 40) {
      msg $chan $+($nick,$chr(44)) Please do not flood the bot.
      inc -z $+(%,botflood.,$nick) 20
      halt
    }
    else { inc -z $+(%,botflood.,$nick) 25 }
  }
  else { inc -z $+(%,botflood.,$nick) 25 }
  msg $chan 4 $+ $iif(%poll == on,Current poll:,Final Poll Results:) $poll
}
alias endpoll {
  set %poll off
  msg %votechan 4Final Poll Results: %vote_title $+(3,%vote1_name,:) %vote1 $percent(%vote1) - $+(4,%vote2_name,:) %vote2 $percent(%vote2)
}
alias poll {
  return  $+ %vote_title $+  $+(3,%vote1_name,:) %vote1 $percent(%vote1) - $+(4,%vote2_name,:) %vote2 $percent(%vote2)
}
alias -l percent {
  var %votes $calc(%vote1 + %vote2)
  return $+($chr(40),$gettok($calc($calc($1 / %votes) * 100),1,$asc(.)),%,$chr(41),)
}

Comments

Sign in to comment.
WiZaRD__   -  Jul 14, 2014

Is there a way that you can see how much the results are in the chat? Like !results or something like that?

illhawkthat  -  Jul 14, 2014

@WiZaRD__ - yes. Use !poll to view the current results or the final values.

Let me know if that doesn't answer your question.

WiZaRD__  -  Jul 14, 2014

Yes its works, thanks for the fast information back and for this nice script.

Sign in to comment

ChaseTheTerrorist   -  Jul 13, 2014

Do you think there's anyway you code this to work with Twitch?

illhawkthat  -  Jul 13, 2014

@ChaseTheTerrorist - yes. Are you already connected to Twitch via mIRC? If so, it's probably a problem with the colors in the script. Try this version http://pastebin.com/4dvi9uB1 and let me know if it works.

Sign in to comment

illhawkthat   -  Jul 12, 2014

Poll in action during the world cup.

 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.