mIRC Home    About    Download    Register    News    Help

Print Thread
Problems creating a polling system for a twitch bo #266342 18/11/19 12:34 PM
Joined: Nov 2019
Posts: 3
C
cookiemac Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Nov 2019
Posts: 3
The input for !startpoll should look like this: !startpoll Question goes here? ~ option1 ~ option2 ~ option3 ~ option4 ~ option5

Quote

on 5:text:!startpoll*:#: {
if(%pollopen == 1) msg $chan Error, A poll is already started please end it before starting another. | return
set %pollopen 1
msg $chan A poll has begun
tokenizelist 126 $2-
if($4 == null) {
msg $chan Vote 1 for $2 or 2 for $3 $+ .
set %text1 $2
set %text2 $3
set %responses 2
}
elseif($5 == null) {
msg $chan Vote 1 for $2 $+ , 2 for $3 or 3 for $4 $+ .
set %text1 $2
set %text2 $3
set %text3 $4
set %responses 3
}
elseif($6 == null) {
msg $chan Vote 1 for $2 $+ , 2 for $3 $+ , 3 for $4 or 4 for $5 $+ .
set %text1 $2
set %text2 $3
set %text3 $4
set %text4 $5
set %responses 4
}
elseif($7 == null) {
msg $chan Vote 1 for $2 $+ , 2 for $3 $+ , 3 for $4 $+ , 4 for $5 or 5 for $6 $+ .
set %text1 $2
set %text2 $3
set %text3 $4
set %text4 $5
set %text5 $6
set %responses 5
}
else msg $chan Error only 5 possible responses may be given.
}

on *:text:!vote*:#: {
if(pollopen == 1) {
if($nick isin %nicklist) {
msg $chan You may only vote once.
return
}
else $addtok( $nick , %nicklist , 32 )
if($2 == 1) inc %option1
elseif($2 == 2) inc %option2
elseif(($2 == 3) && (%responses > 2)) inc %option3
elseif(($2 == 4) && (%responses > 3)) inc %option4
elseif(($2 == 5) && (%responses > 4)) inc %option5
else msg $chan Only the numbers 1-5 are accepted as voting responses.
}
elseif(pollopen == 0) msg $chan No poll is open.
}

on 5:text:!endpoll:#: {
$sorttok(%option1 %option2 %option3 %option4 %option5 , nr)
if($1 == %option1) msg $chan %text1 is the top choice.
elseif($1 == %option2) msg $chan %text2 is the top choice.
elseif($1 == %option3) msg $chan %text3 is the top choice.
elseif($1 == %option4) msg $chan %text4 is the top choice.
elseif($1 == %option5) msg $chan %text5 is the top choice.
set %text1 null
set %text2 null
set %text3 null
set %text4 null
set %text5 null
set %responses null
set %option1 0
set %option2 0
set %option3 0
set %option4 0
set %option5 0
set %pollopen 0
}

alias tokenizelist {
var %x 1
tokenize $1 $2-
while ($(,$ $+ %x) != $null) {
echo $ $+ %x = $v1
inc %x
}
}

I really appreciate any help or advice you could have!

Re: Problems creating a polling system for a twitch bo [Re: cookiemac] #266343 18/11/19 04:52 PM
Joined: Feb 2011
Posts: 325
K
KindOne Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Feb 2011
Posts: 325
That script has a bunch of syntax issues and other things wrong with it.

What about using this one?

https://forums.mirc.com/ubbthreads.php/topics/245941


irc.swiftirc.net #msl (mIRC Scripting Language)