Result:
Code: Select all
;
; mail and tells
;
; definitions
/def e = /echo -aBCcyan %{*}
/def clearmail = \
/unset total_mail %;\
/e @ mail notifications cleared
/def mail = \
/if ({total_mail}=~NULL) \
/e @ no new mail %;\
/else \
/let _mail=%{total_mail} %;\
/e @ there is NEW mail: %;\
/while /let i=$[strstr({_mail},"|")] %;\
/@test i>-1 %;\
/do \
/echo -p @{BCcyan}@ @{n}$[substr({_mail},0,5)] from @{B}$[substr({_mail},5,i-5)]@{n} %;\
/let _mail=$[substr({_mail},i+2)] %;\
/done %;\
/e @ type "/clearmail" to clear the mail %;\
/endif
/def cleartells = \
/unset total_tells %;\
/e @ wiztell notifications cleared
/def tells = \
/if ({total_tells}=~NULL) \
/e @ no new tells %;\
/else \
/let _tells=%{total_tells} %;\
/e @ there are NEW tells: %;\
/while /let i=$[strstr({_tells},"|")] %;\
/@test i>-1 %;\
/do \
/echo -p @{BCcyan}@ @{n}$[substr({_tells},0,5)] from @{B}$[substr({_tells},5,i-5)]@{n} %;\
/let _tells=$[substr({_tells},i+2)] %;\
/done %;\
/e @ type "/cleartells" to clear the tells %;\
/endif
/def mailtells = \
/mail %;\
/tells
/def clearmailtells = \
/clearmail %;\
/cleartells
; triggers
/def -F -mregexp -t'^Postmaster tells you that you have new mail from (.*)\.$' new_mail = \
/set total_mail=$[strcat({total_mail},ftime("%H:%M",time()),{P1},"|")]
/def -F -mregexp -t'^Your mailbox contains' mailbox_visited = \
/unset total_mail
/def -F -mregexp -t'^An apparition of (.*) appears to you\.' wiz_tell = \
/set total_tells=$[strcat({total_tells},ftime("%H:%M",time()),{P1},"|")]
/mail for mail
/tells for tells
/mailtells for both
/clearmail, /cleartells, /clearmailtells respectively
Enjoy!
Edit: All the names used are coincidental. I've set the variables manually to show different name lengths.
Edit: Note that this are only notifications. The actual tell messages are not logged.