问题描述
我是mirc脚本编写的新手,并且需要一些帮助。
I’m a noob in mirc scripting, and I need some help.
- 有2个irc频道。我们先叫#channel1和#channel2;
- 有2个漫游器。一个是我的,我们称他为 mybot(两个通道中都有我的机器人)。另一个机器人来自第三方,我们称他为 otherBot;
我需要的是……让我举一个例子更好地解释。
What I need is… let me make an example to better explain.
a)在#channel1中某些用户类型:
a) in #channel1 some user type:
[14:38:48] <@someuser> !user xpto
这时,两个频道中都存在 mybot。他读取命令!user *并将其复制/粘贴到#channel2中,其中 otherBot将识别命令!user *并粘贴有关此命令的一些信息。
At this time, "mybot" is in both channels. he reads the command "!user*" and copy/paste it in #channel2, where the "otherBot" will recognize the command "!user*" and will paste some information about this command.
b)因此,在#channel2中,它将添加以下内容:
b) so, in #channel2 it will append something like:
[14:38:50] <@ mybot > !user xpto
[14:38:52] <@ otherBot > User name is xpto and he likes popatos.
现在我希望 mybot读取 otherBot提供的信息,然后将其粘贴到#channel1
Now I want that "mybot" reads the information provided by the "otherBot" and then paste it on #channel1
c)因此,在#channel1中:
c) so, in #channel1:
[14:38:54] <@ mybot > User name is xpto and he likes popatos.
到目前为止,我的遥控器上有fowling代码:
So far I have the fowling code in my remote:
on *:TEXT:!user*:#channel1 {
/msg # channel2 $1-
}
on *:TEXT:User name*:#channel2 {
if $address($nick,2) == *!*@otherBot.users.gameea {
/msg # channel1 $1-
}
}
这很好,但有一个问题:如果有人(不是在#channel2中键入!user kakaka, mybot还将复制/粘贴 otherBot提供的信息,然后将其粘贴到#channel1上。而且我只希望 mybot仅复制/粘贴 mybot询问的信息至 otherBot。
This works fine, but have a problem: if someone else ( not "mybot" ) type "!user kakaka" in #channel2, "mybot" will also copy/paste the information provided by the "otherBot" and then paste it on #channel1. And I only want that "mybot" copy/paste only the information that "mybot" ask to "otherBot".
推荐答案
A一种非常简单(但不是特别好)的方法是,当有人在#channel1中键入!user时,设置一个全局变量,并检查是否在正在#channel2上监听的另一部分中设置了此变量。例如:
A very simple (but not a particularly nice) way of doing this could be to set a global variable when someone types !user in #channel1, and check whether or not this is set in the other part which is listening on #channel2. For example:
on *:TEXT:!user *:#channel1: {
set %repeatUser 1
msg channel2 $1-
}
on *:TEXT:User name*:#channel2: {
if ($address($nick,2) == *!*@otherBot.users.gameea && %repeatUser == 1) {
unset %repeatUser
msg #channel1 $1-
}
}
这不是一个完美的解决方案,因为如果僵尸程序在脚本发送时间之间说了另外的话!用户到另一个频道并让漫游器响应,然后它将打印出该回复,而不是针对您的请求的回复,但这仅在#channel2异常繁忙,otherbot非常懒散或发生这种情况时才有意义您的机器人和其他人都在不到一秒钟的时间内,在#channel2上输入!user。
This isn't a perfect solution, since if the bot says something else between the time it takes for the script to send '!user' to the other channel and for the bot to respond, then it will print out that reply instead of the one for your request, but this is only relevant if #channel2 is ridiculously busy, otherbot is very laggy, or it just so happens that both your bot and someone else type !user on #channel2 within a fraction of a second of eachother.
这篇关于mIRC bot-在2个通道中复制/粘贴行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!