TF mail/wiztell logging

Need some help with your MUD client? Forgot your password? Get help here.
Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
Post Reply
User avatar
Rhaegar
Legend
Posts: 960
Joined: 13 May 2010 06:22

TF mail/wiztell logging

Post by Rhaegar » 21 Jan 2011 07:12

Inspired by Earth's mail logging with timestamps script idea I've decided to create my own, with a lot of success.

Result:

Image

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},"|")]
Usage:
/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.
I fear no evil for I am fear incarnate.

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/