2017-06-13 97 views
0

我一直在嘗試幾天,爲此代碼中的「postmessage」別名添加2秒的延遲。我試過的東西似乎沒有用。你如何爲這個腳本添加2秒的延遲?就像第一條消息在觸發時立即發送,而第二條消息在第一條消息發送後2秒。如何將2秒的延遲添加到postmessage別名(mIRC)

完整的代碼是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 ] ] 
    } 
} 

回答

2

你必須要與timer另一個別名調用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而不是postmessage