Oh look I can pipe the script to make it look smaller:
alias msg {
if ($len($2-) > 466) { var %channel $1 | tokenize 32 $2- | var %tot $0 | var %x 1 | var %msgnum 1 | while (%x <= %tot) { if ($len($($+($,%msgnum,-,%x),2)) > 466) { msg %channel $($+($,%msgnum,-,$calc(%x - 1)),2) | var %msgnum %x } | inc %x } } | else msg $1- }
Sorry, couldn't resist. Anywho, nice work Plornt.