you have the right idea with $replace(). however, since $chr(160) may appear in $rawmsg, it's inadvisable to use it in this case; you would be obliged to substitute any pre-existing $chr(160) characters back using a technique similar to the one i provided in this post:

https://forums.mirc.com/ubbthreads.php?ubb=showflat&Board=8&Number=226545&

it's safe to use $lf for the replacements, since you can be absolutely sure that $rawmsg won't contain it:

Code:
bset -t &var 1 $replace($rawmsg, $chr(32), $lf)
breplace &var 10 32




"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde