scripting - Problems creating a polling system for a twitch bot -


i attempting create script capable of polling twitch channel. have written basic idea of i'm having trouble working out kinks. have experience programming in c , java still new mirc. i'm having issues scripts not doing anything.

the input !startpoll should this: !startpoll question goes here? ~ option1 ~ option2 ~ option3 ~ option4 ~ option5

on 5:text:!startpoll*:#: {   if(%pollopen == 1) msg $chan error, poll started please end before starting another. | return   set %pollopen 1   msg $chan poll has begun   tokenizelist 126 $2- if($4 == null) { msg $chan vote 1 $2 or 2 $3 $+ . set %text1 $2 set %text2 $3 set %responses 2 } elseif($5 == null) { msg $chan vote 1 $2 $+ , 2 $3 or 3 $4 $+ . set %text1 $2 set %text2 $3 set %text3 $4 set %responses 3 } elseif($6 == null) { msg $chan vote 1 $2 $+ , 2 $3 $+ , 3 $4 or 4 $5 $+ . set %text1 $2 set %text2 $3 set %text3 $4 set %text4 $5 set %responses 4  } elseif($7 == null) { msg $chan vote 1 $2 $+ , 2 $3 $+ , 3 $4 $+ , 4 $5 or 5 $6 $+ . set %text1 $2 set %text2 $3 set %text3 $4 set %text4 $5 set %text5 $6 set %responses 5 } else msg $chan error 5 possible responses may given. }  on *:text:!vote*:#: { if(pollopen == 1) { if($nick isin %nicklist) {   msg $chan may 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 numbers 1-5 accepted voting responses. } elseif(pollopen == 0) msg $chan no poll open. }  on 5:text:!endpoll:#: {   $sorttok(%option1 %option2 %option3 %option4 %option5 , nr)   if($1 == %option1) msg $chan %text1 top choice.   elseif($1 == %option2) msg $chan %text2 top choice.   elseif($1 == %option3) msg $chan %text3 top choice.   elseif($1 == %option4) msg $chan %text4 top choice.   elseif($1 == %option5) msg $chan %text5 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 appreciate or advice have!


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -