Notice reply alias

From Scriptwiki
Jump to: navigation, search
;====================================
; Script designed to use /r to reply to notices, based on individual networks.
; Copy and paste into the scripts editor remote tab, and use /r when you receive a notice to reply to one
;==================================== 
; When a user notices you
on *:NOTICE:*:?: {
; If the last user to notice you is not from this connection
  if (%_aca.last_notice_from_cid_ [ $+ [ $cid ] ] != $nick) {
; Set the variable of the last user to notice you from this connection, as $nick
    set %_aca.last_notice_from_cid_ $+ $cid $nick
; Echo the notice
    echo -atg ***Notice: Use /r <message> to reply to $nick on $scid($cid).network
  }

} 
; The /r alias for replies
alias r {
; If there was a user who noticed you recently from this network
  if (%_aca.last_notice_from_cid_ [ $+ [ $cid ] ]) {
; Reply to him
    notice %_aca.last_notice_from_cid_ [ $+ [ $cid ] ] $1-
  }
; Otherwise
  else {
; Echo that there are no saved users
    echo -atg */r: No saved user has noticed you recently on this network.
  }
}
; When mIRC starts, remove all other saved notices
on *:START:unset %_aca.last_notice_from_cid* 
; When a user changes his nick
on *:NICK: {
; If it was the one we are replying to
  if (%_aca.last_notice_from_cid_ [ $+ [ $cid ] ] == $nick) { 
; Change the stored nick
    set %_aca.last_notice_from_cid_ $+ $cid $newnick
  }
}