0

我正在尝试创建一个能够轮询抽搐频道的脚本。我已经写了它的基本概念,但我无法解决这些问题。我有 C 和 Java 编程经验,但对 mIRC 还是很陌生。我的脚本有问题,根本没有做任何事情。

!startpoll 的输入应如下所示: !startpoll 问题在这里?~ 选项 1 ~ 选项 2 ~ 选项 3 ~ 选项 4 ~ 选项 5

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
  }
}

我非常感谢您提供的任何帮助或建议!

4

0 回答 0