mIRC Home    About    Download    Register    News    Help

Print Thread
Automatic long text break-up #143617 26/02/06 12:33 PM
Joined: Feb 2006
Posts: 2
S
Skiedragon Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Feb 2006
Posts: 2
I would like to see an option which would automatically break up the lines for you if they got too long when sending them. I know there's the "beep" sound every letter you hit over the limit of some 500 (?) letters, but that isn't exactly that accurate. A couple of words usually go missing if you stop one letter before the limit.

Re: Automatic long text break-up #143618 26/02/06 04:28 PM
Joined: Feb 2003
Posts: 372
R
Rounin Offline
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2003
Posts: 372
I think the limit is 512 bytes, but that's including the command part that goes to the server and which doesn't show in the channel.

I agree with you though... It's especially troublesome when someone tries to make a really long argument, and winds up going "and above all, you must remember to la", without being aware that they've been cut off. If they're pasting something and it has multiple paragraphs, the end result can become almost unreadable.

Still, I wonder if this hasn't been requested before? I think it's been discussed at some point, but I can't remember when.

Re: Automatic long text break-up #143619 26/02/06 06:17 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
This sounds like it could be a useful feature. It may be a good idea to include options for it though. "Enable/Disable" and "Auto/Ask" come to mind.

I came up with this code a while ago for a similar problem. It could be used to detect if the text is too long to send on one line, and break it up. This code doesn't actually do that splitting, it just tests how the max character len that can be sent as a PRIVMSG.

Code:
on *:CONNECT:.msg $me $+(MLT-,$str(,512))
on me:^*:NICK:.msg $newnick $+(MLT-,$str(,512))
on me:^*:TEXT:MLT-*:?:{ set $+(%,MCL.,$cid) $len($gettok($rawmsg,3-,32)) | haltdef }
on *:DISCONNECT:unset $+(%,MCL.,$cid)
alias maxchars return $iif($($+(%,MCL.,$cid),2),$ifmatch,512)


The max length is everything that comes after the PRIVMSG in the $rawmsg. This could be tested with something like this:
Code:
on *:INPUT:#:{
  if ((/* iswm $1) && (!$ctrlenter)) return
  if ($len($target $1-) > $maxchars) echo 4 -at *** This line was cut off at this point: $mid($target $1-,$calc($maxchars - 16),15)
}


-genius_at_work

Last edited by genius_at_work; 26/02/06 06:45 PM.
Re: Automatic long text break-up #143620 26/02/06 07:13 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
This code should send long lines as multiple messages:
Code:
on *:INPUT:#:{
  if ((/* iswm $1) && (!$ctrlenter)) return
  var %mcllines = $ceil($calc($len($1-) / $maxchars))
  var %mcllen = $floor($calc(($len($1-) + $len($str($target $+ ..,%mcllines))) / %mcllines)))
  var %mclpre = $calc(%mcllen - $len($target $+ $chr(32)))
  while ($left($1,%mclpre)) {
    msg $target $v1
    tokenize 32 $right($1,$+(-,%mclpre))
  }
  halt
}


It seems that the editbox can only process 950 chars, so this code will try to split up long text into even lines when it sends them.

-genius_at_work

Re: Automatic long text break-up #143621 28/02/06 03:22 PM
Joined: Feb 2006
Posts: 2
S
Skiedragon Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Feb 2006
Posts: 2
Quote:
genius_at_work wrote:
This sounds like it could be a useful feature. It may be a good idea to include options for it though. "Enable/Disable" and "Auto/Ask" come to mind.


Yup, I said that an option of such would be nifty to have.

About your script, genius: It would be nice if it also worked somehow in actions (/me) and query windows as well. The script also bugs quite much. It works okay if you don't go over the point where there's too many characters in the editbox and mIRC automatically posts what you've written. If that happens, the script just refuses to work after and your lines don't get seperated to smaller lines anymore. The script just posts something that's left in the buffer, defined as some variable, I guess. Needs a little bit of fine-tuning.

It would also be nice if it added ellipsis (...) in the points where it cuts, before and after.

I completely suck at scripting, so I don't know how to fix it.

Automatic long text break-up #143622 28/02/06 09:32 PM
Joined: Feb 2006
Posts: 1
S
ShatteredRoses Offline
Mostly harmless
Offline
Mostly harmless
S
Joined: Feb 2006
Posts: 1
While I'm very new to IRC, and it's therefore very likely that I'm doing something very wrong, the code above for some reason causes something to go horribly wrong. When I have it running, nothing I type shows up at all. I have no idea what I'm doing or not doing to cause that.
I'd really appreciate any advice or further development on this one, as I could really, really do with the ability to type much longer messages.