looks like you just want:
echo -a $d!t.buffer(MSG) < $nick > $1-
exactly as you'd normally have in your theme:
echo -ta < $nick > $1-
(generalised of course the -t would put in a timestamp normally) Replace the MSG with EVENT for room joins,parts,quits,etc etc.