我已经连续几天尝试在邮寄消息中添加2秒延迟"此代码中的别名。我尝试过的任何东西似乎都没有用。如何为此脚本添加2秒延迟?就像让第一条消息在被触发时立即发送,但第二条消息在第一条消息后2秒发送。
完整代码为here。
这是我需要帮助的部分代码:
alias postmessage {
IF (%notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]) {
VAR %x_notes 1
WHILE ($gettok(%notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ],%x_notes,32)) {
MSG $chan %note_from_to. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $v1 ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
UNSET %note_from_to. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $v1 ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
INC %x_notes
}
UNSET %notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
}
}
答案 0 :(得分:2)
您必须使用timer制作另一个别名才能调用urllib2
别名
例如
postmessage
alias postmessageDelayed {
; the next line of code will have a delay of 2 seconds
.timer 1 2 postmessage
}
alias postmessage {
IF (%notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]) {
VAR %x_notes 1
WHILE ($gettok(%notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ],%x_notes,32)) {
MSG $chan %note_from_to. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $v1 ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
UNSET %note_from_to. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $v1 ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
INC %x_notes
}
UNSET %notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
}
}
表示只运行一次
1
表示在执行
要使用此致电2
而非postmessageDelayed