mIRC Home    About    Download    Register    News    Help

Print Thread
Poll system with plenty of options #248809 27/10/14 02:31 AM
Joined: Aug 2014
Posts: 26
S
Stracked Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2014
Posts: 26
Hello There again..
So I was wondering if there is a Poll system with a large amount of options
I found this code (bottom of this thread) And I like it but problem is I only can use 4 options..

First Off i need it not to be triggered in chat because the options are alot.... around a 100 ...

Help smile?
(or if anyone knows a system for Twitch Plays League of legends that would be cool too)

Code:
menu * {
Poll:Voted
}
alias voted dialog -mo poll poll
dialog poll {
  option dbu
  title "Poll Script"
  size -l -l 150 90
  edit "Option 1", 1, 5 40 80 10,autohs
  edit "Option 2", 2, 5 50 80 10,autohs
  edit "Option 3", 3, 5 60 80 10,autohs
  edit "Option 4", 4, 5 70 80 10,autohs
  button "New Poll" ,5,13 5 40 15,
  button "End Poll" ,6,53 5 40 15,
  box "", 7, 85 36 15 45
  text "0" 8, 90 40 7 10
  text "0" 9, 90 50 7 10
  text "0" 10, 90 60 7 10
  text "0" 11, 90 70 7 10
  button "Show Results" ,12,93 5 40 15,
  edit "Question", 13, 5 20 130 10,autohs
}
on *:Dialog:Poll:*:*: {
  if ($devent == init) {
    if (%vote) {
      did -ra $dname 8 $iif($hget(Vote,1),$v1,0)
      did -ra $dname 9 $iif($hget(Vote,2),$v1,0)
      did -ra $dname 10 $iif($hget(Vote,3),$v1,0)
      did -ra $dname 11 $iif($hget(Vote,4),$v1,0)
      did -ra $dname 13 $iif($hget(Vote,Question),$v1,Question)
      did -ra $dname 1 $iif($hget(Vote,Question1),$v1,Option 1)
      did -ra $dname 2 $iif($hget(Vote,Question2),$v1,Option 2)
      did -ra $dname 3 $iif($hget(Vote,Question3),$v1)
      did -ra $dname 4 $iif($hget(Vote,Question4),$v1)
      did -b $dname 5
    }
    else did -b $dname 6
  }
  if ($devent == sclick) {
    if ($did == 12) {
      if ($hget(Vote,1)) {
        amsg Results For Question: $hget(Vote,Question)
        if ($hget(vote,Question1)) amsg 15*** 14[7Poll14]14 Option 1: $hget(Vote,Question1) - $iif($hget(Vote,1),$v1,0)
        if ($hget(vote,Question2)) amsg 15*** 14[7Poll14]14 Option 2: $hget(Vote,Question2) - $iif($hget(Vote,2),$v1,0)
        if ($hget(vote,Question3)) amsg 15*** 14[7Poll14]14 Option 3: $hget(Vote,Question3) - $iif($hget(Vote,3),$v1,0)
        if ($hget(vote,Question4)) amsg 15*** 14[7Poll14]14 Option 4: $hget(Vote,Question4) - $iif($hget(Vote,4),$v1,0)
      }
      else error You do not currently have any results, You must start a new poll and wait for people to vote.
    }
    if ($did == 6) { 
      unset %vote
      amsg 15*** 14[7Poll14]14 Poll has closed!
      amsg 15*** 14[7Poll14]14 To view results type !Results
      did -e $dname 5
      did -b $dname 6
    } 
    if ($did == 5) {
      if ($did(2).text != Option 2) {
        if ($hget(Vote)) hfree vote
        amsg 15*** 14[7Poll14]14 A poll has started! To vote type !Vote <Number>
        amsg 15*** 14[7Poll14]14 The question is:10 $did(13).text
        amsg 15*** 14[7Poll14]14 The options are #1 $did(1).text - #2 $did(2).text $iif($did(3).text,- #3 $did(3).text) $iif($did(4).text,- #4 $did(4).text)
        hadd -m Vote Question1 $did(1).text
        hadd Vote Question $did(13).text
        hadd Vote Question2 $did(2).text
        hadd Vote Question3 $did(3).text
        hadd Vote Question4 $did(4).text
        set %vote on
        did -b $dname 5
        did -e $dname 6
      }
      else error 15*** 14[7Poll14]14 You must specify atleast two options!
    }
  }
}
on $*:TEXT:/^[.!@~]Vote/Si:#: {
  tokenize 32 $replace($1-,one,1,two,2,three,3,four,4)
  if (%vote) {
    if ($2 isnum) {
      if ($hget(Vote,Question $+ $2)) {
        if ($hget(Vote,$iif($address($nick,2),$v1,$nick)) == $null) {
          hadd Vote $iif($address($nick,2),$v1,$nick) $2
          hinc -m Vote $2
          if ($dialog(Poll)) did -ra Poll $calc($2 + 7) $hget(Vote,$2)
          notice $nick 15*** 14[7Poll14]14 Thank you for your vote, You have voted for option:15 $hget(Vote,Question $+ $2)
        }
        else notice $nick 15*** 14[7Poll14]14 Sorry, you have already voted! Your vote was for,15 $hget(Vote,Question $+ $v1)
      }
      else notice $nick 15*** 14[7Poll14]14 Sorry, there is no option $chr(35) $+ $2
    }
    else notice $nick 15*** 14[7Poll14]14 You must vote for a number from 1-4
  }
  else notice $nick 15*** 14[7Poll14]14 There is currently no poll commencing
}
on $*:TEXT:/^[.!@]Result/Si:#: {
  if (!$timer(Poll $+ $nick)) {
    if ($hget(Vote,Question)) {
      .timerpoll $+ $nick 1 5 noop
      notice $nick Current results for poll: $hget(Vote,Question)
      if ($hget(vote,Question1)) notice $nick 15*** 14[7Poll14]14 Option 1: $hget(Vote,Question1) - $iif($hget(Vote,1),$v1,0)
      if ($hget(vote,Question2)) notice $nick 15*** 14[7Poll14]14 Option 2: $hget(Vote,Question2) - $iif($hget(Vote,2),$v1,0)
      if ($hget(vote,Question3)) notice $nick 15*** 14[7Poll14]14 Option 3: $hget(Vote,Question3) - $iif($hget(Vote,3),$v1,0)
      if ($hget(vote,Question4)) notice $nick 15*** 14[7Poll14]14 Option 4: $hget(Vote,Question4) - $iif($hget(Vote,4),$v1,0)
    }
    else notice $nick There are currently no poll results.
  }
}

Re: Poll system with plenty of options [Re: Stracked] #248825 27/10/14 10:35 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Try use this snippet maybe is that you need: http://hawkee.com/snippet/16067/

Re: Poll system with plenty of options [Re: westor] #248828 28/10/14 12:52 AM
Joined: Aug 2014
Posts: 26
S
Stracked Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2014
Posts: 26
Its a good script but same thing as last post ... Not what I am looking for :P Could you kinda read the paragraph x3