mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2019
Posts: 5
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Nov 2019
Posts: 5
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!

Joined: Feb 2011
Posts: 448
K
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 448
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


Link Copied to Clipboard