mIRC Homepage
Posted By: krizoek message splitter for msg's and notice's - 29/06/08 01:27 PM
I have noticed that servers have charlimits, and when typing from a editbox; or whatever. this from my viewpoint show many more chars. but others see the text only by 448 chars.

Would be nice with a function that splitted the texts(where there was spaces in text), and a option for the servers in the serverslist where one might set this "starting point" from where it searches for spaces. I made a script for this, but perhaps something like this could easily be integrated into mirc.

here is the code:

alias messagesplitter {
%tempdata = $3-
if ($len(%tempdata) > 440) {
while ($len(%tempdata) > 440) {
%vcharsearch = a
%vcharsearchingnumber = 440
%vcharsearch = $asc($mid(%tempdata,%vcharsearchingnumber,%vcharsearchingnumber))
if (%vcharsearch != $chr(32)) {
while ((%vcharsearch != 32) && (%vcharsearchingnumber > 350)) {

%vcharsearch = $asc($mid(%tempdata,%vcharsearchingnumber,%vcharsearchingnumber))
dec %vcharsearchingnumber
}
}
if ($2 == m) /msg $1 $mid(%tempdata,0,%vcharsearchingnumber)
if ($2 == n) .notice $1 $mid(%tempdata,0,%vcharsearchingnumber)
%tempdata = $mid(%tempdata,$calc(%vcharsearchingnumber + 1))
}
if (($len(%tempdata) > 0) && ($2 == m)) { /msg $1 %tempdata }
elseif (($len(%tempdata) > 0) && ($2 == n)) { .notice $1 %tempdata }
}
elseif ($2 == m) { /msg $1 %tempdata } ; m = msg, $1 is the chan, or nick to send the text to
elseif ($2 == n) { .notice $1 %tempdata } ; n = notice
unset %tempdata %spacepos %chan %vcharsearchingnumber %vcharsearch %vcharsearch
}
Posted By: argv0 Re: message splitter for msg's and notice's - 29/06/08 03:52 PM
Well, as we discussed in #mIRC, it's not always 448 chars.. in fact, it's rarely "448". This is also very easy to script:

Code:
on *:INPUT:*: {
  if (/* iswm $1-) return
  var %line = $1-, %re = /(.{0,400})(?:\s(.*)|$)/
  while (%line != $null) {
    noop $regex(%line, %re)
    msg $iif(#,#,$target) $regml(1)
    %line = $regml(2)
  }
  halt
}


It's also something that involves many customized scripting decisions like whether to use flood protection on the output, how many lines to write before stopping, whether to stop at the space or to cut a word in half, and how long a "line" is to begin with. mIRC could make some of these decisions automatically, but some users may want a manually defined set of options.. I could decide I'd rather split my lines at 200 chars, regardless of server length. It would be a lot simpler to just use the ~8 lines of script above
© mIRC Discussion Forums