Topic changes are not captured with on MODE afaik.
As for the on input script: /topic, /quit, /join, /part, /mode and /nick will have their normal events triggered even if you do the command, since the server sends those back. That leaves /msg, /me, /ame, /amsg, /describe and /echo and for those it seems best to make a custom alias that handles the logging.
alias say { say $1- | write $+($active,.,$network,.,$date(yyyymmdd),.log) $+([,$time(hh:nntt),]) $+(<,$nick,>) $1- }
alias msg { msg $1- | write $+($1,.,$network,.,$date(yyyymmdd),.log) $+([,$time(hh:nntt),]) $+(<,$me,>) $1- }
etc...
btw, the below line is valid, but handled incorrectly in your on INPUT script:
/// msg $me I sent this to myself!
The on INPUT is still needed though, but only for lines not starting with /:
on *:INPUT:*:{
if ((/* iswm $1) && (!$ctrlenter)) return
say $1-
halt
}
(Yes I should get the alternate command character too, I never found anyone actually using it))