Tfnotes
Someone mentioned on the guild chat line that they wished the mud had a 'note' comand to jot down a note. This got me thinking…
Two simple routines. One (/notewrite -f<filename> <text>) writes a timestamped color attr enabled line to <filename>. If you do NOT specify <filename> it defalts to 'notes'. The other routine (/noteread -f<filename>) reads a file (color attr enabled) and also defaults to 'notes'. Handy to keep track of little things.
I keep this little snipit in my Zmacros.tf file. It uses the PPNotice routine found on this site. Both are from the Zmacros.tf file.
;;; notewrite/noteread ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; /notewrite [-f<filename>] <text>
; writes color coded <date> <time> <text> to <filename> or defalts to 'notes'
; /notewrite <text>
; writes color coded <date> <time> <text> to file 'notes'
; /notewrite -flevel advanced @{BCred}int@{n}
; writes colorcoded <date> <time> advanced int to file 'level'
; Note you can embed display attrs
;
; /noteread [-f<filename>]
; outputs contents of <filename> or 'notes' to the screen (output stream)
; /noteread
; outputs contents of file named 'notes' to the screen (output stream)
; /noteread -flevel
; outputs contents of file named 'level' to the screen (output stream)
;
/def notewrite = \
/let opt_f=notes%; \
/if (!getopts("f:")) /return 0%; /endif %; \
/let TotalLine=%{*}%; \
/let text=$[strcat("@{Cgreen}",ftime('%Y-%m-%d')," ",ftime('%H:%M:%S'),"@{n}"," ",TotalLine)] %; \
/eval /set notefile=$[tfopen({opt_f},'a')]%; \
/test tfwrite({notefile},{text})%; \
/test tfclose({notefile})%; \
/test PPNotice(1,"Notes written to $[opt_f]")
/def noteread = \
/let opt_f=notes%; \
/if (!getopts("f:")) /return 0%; /endif %; \
/test PPNotice(1,"Reading $[opt_f]")%; \
/eval /set notefile=$[tfopen({opt_f},'r')]%; \
/let line=%; \
/while (tfread({notefile}, line) >= 0) \
/let line=$[decode_attr(line)]%; \
/test tfwrite("o", line)%; \
/done%; \
/test tfclose({notefile})





