试图让脚本在比赛中从 txt 文件播放

trying to get script to play from txt file on match

我正在编写黑名单脚本,到目前为止它运行良好。我正在添加昵称和原因,它可以很好地保存和删除。

alias -l txt { return C:\Users\hifin\Desktop\mibbitnames\badnick.txt }
alias -l mychan { return #mastercontrol }

ON *:TEXT:!add *:$($mychan): {
  write $qt($txt) -
  msg $chan 4ADD Watched nick - -
}

ON *:TEXT:!del *:$($mychan): {
  write -d $qt($txt) -
  msg $chan 3DELETED Watched nick - -
}

ON *:TEXT:!viewlist:$($mychan): {
  var %t = $lines($txt)

  if (!$file($txt)) { msg $chan The file is empty! | return }

  msg $chan 6LIST Incoming PM
  msg $nick Start of file.. - (Lines: %t $+ )

  var %i = 1
  while (%i <= %t) { 
    var %r = $read($txt,n,%i)

    if (%r) { msg $nick %r }

    inc %i
  }

  msg $nick End of file. - (Size: $bytes($file($txt).size).suf $+ )
}

从这个脚本..我正在使用一个匹配的代码来查看这个文件上是否有缺口,这工作正常

var %NaughtyList = $read(C:\Users\hifin\Desktop\mibbitnames\badnick.txt, sw, )
    if (%NaughtyList) {
      /msg #mastercontrol 9,1Connected Watched Nick  - 
      splay -w C:/Users/hifin/Desktop/New_Server_Bot/mIRC/sounds/message.wav
    }

现在..这是我需要改变的,但我做不到.. atm .. 我正在 txt 磁贴上查找匹配的昵称,该昵称始终由 $4 指定... 但是..我希望脚本向频道发送昵称消息 - 原因来自 txt 文件.. 在 atm 上它只是说已连接观看尼克 - 4 美元(尼克)

txt 文件在像这样的单独行上包含昵称原因

gary troublemaker 
radomly testuser 
julie needs help with channel

我能否进行编辑,以便脚本从 txt 文件中输出有关匹配昵称“和”原因的信息

$read() 使用 s 开关 returns 文本 匹配的词之后,根据文档:

//echo $read(info.txt, s, mirc)
Scans the file info.txt for a line beginning with the word mirc and returns the text following the match value.

您可以将 $read()$readn 结合使用,如果找到匹配项 returns 行号,并执行如下操作:

var %NaughtyList = $read($txt, s, )
if ($readn) {
  var %buf = $read($txt, $readn)
  msg #mastercontrol Connected Watched $gettok(%buf, 1, 32) - $gettok(%buf, 2-, 32)
  splay -w C:/Users/hifin/Desktop/New_Server_Bot/mIRC/sounds/message.wav
}

这将获取昵称和原因并输出

Connected Watched julie - needs help with channel

搜索 julie.