I always have a problem finding a decent cut script for IRC after I haven’t been on in a while, so I’m going to alleviate the problem by posting ones I find on here. I’ve got scripts for Mac and Windows apps, so I should have anything you need here.
WINDOWS
mIRC:
on 1:input:*: {
if ($len($1-) > 420) {
%cuttext = $remove($1-,$left($1-,405))
/timerCut 1 1 /say 6-- %cuttext
}
}
This is a simple cut script that counts the characters and cuts and then pastes the rest in another post.
on 1:input:*: {
%textcut = 21 | %actioncut = 26 | %cutat = 425 | %nicklen = $len($$me) | %length = $len($1-)
if ($left($1,1) = / ) { %length = %length - $len($1)
; Next line might need additional commands ?
if ($1 = /me ) || ($1 = /action ) { %length = %length + 7 | %textcut = %actioncut }
; Prevent cut for "unseen" commands eg a long /alias (may need extra commands?)
elseif ($1 != /say ) { goto end }
}
%cutit = %length + %nicklen
if (%cutit > %cutat) { %cutlen = %cutit - %cutat | %word = $0 | inc %word | %cuttext = ""
:loop
dec %word
if (%word > 0) && ($len(%cuttext) < %cutlen) { %ins = $gettok($1-,%word,32) | %cuttext = $instok(%cuttext,%ins,1,32) | goto loop }
%lastcolour = $null | %leftlen = 0 - $len(%cuttext) | %lefttext = $left($1-,%leftlen)
:colour
%lastcolourn = $pos(%lefttext,,0)
if ( %lastcolourn > 0 ) { %lastcolourp = $pos(%lefttext,,%lastcolourn) | %lastcolour = $mid(%lefttext,%lastcolourp,6) | %comma = ,
if ( $pos(%lastcolour,%comma,0) != 1) { %lastcolour = $left(%lastcolour,3) }
elseif ( $pos(%lastcolour,%comma,1) != 3 ) && ( $pos(%lastcolour,%comma,1) != 4) { %lastcolour = $left(%lastcolour,3) }
:colloop
if ($mid(%lastcolour,2,1) !isnum) { %lastcolour = $right(%textcut,2) }
if ( $right(%lastcolour,1) !isnum ) { %leng = $len(%lastcolour) | dec %leng | %lastcolour = $left(%lastcolour, %leng)
if ($len(%lastcolour) > 1) { goto colloop }
else ( dec %lastcolourp | %lefttext = $left(%lefttext,%lastcolourp) | goto colour }
}
/timerCut 1 1 /say %textcut $+ %lastcolour %cuttext
{
:end
}
}
Mrs Fireshaper uses this one and it’s great, especially when you use “/me” and a lot of colors.
MAC
XChat
use strict;
use warnings;
my $max_length = 25;
Xchat::register( "Action Splitter", "1.0" );
Xchat::hook_command( "me", \&command_me );
my $count = 0;
sub command_me {
my $text = $_[1][1];
if( length( $text ) > $max_length ) {
my @segments = segments( $text, $max_length );
Xchat::print ++$count;
Xchat::commandf( "me %s", shift @segments );
Xchat::command( [map { s/^/say /; $_ } @segments] );
$count--;
return Xchat::EAT_ALL;
}
return Xchat::EAT_NONE;
}
sub segments {
my ($text, $max) = @_;
my @segments;
if( length( $text ) > $max ) {
while( length( $text ) > $max ) {
my $end = rindex( $text, ' ', $max );
if( $end < 0 ) {
# no space in the message
$end = $max - 1;
}
push @segments, substr( $text, 0, $end );
$text = substr( $text, $end + 1 );
}
push @segments, $text;
} else {
push @segments, $text;
}
Xchat::print $_ for @segments;
return @segments;
}
Just copy all of that and post it into TextEdit and save it as a .pl file. Then put it in your Plugins folder for XChat.
Colloquy
I am working on an AppleScript for Colloquy at the moment and I have run into a problem. If you are good at AppleScripting for Colloquy please let me know.
I have xchat-but how do I save the file as pl in text edit? It won’t let me.
Comment by Jess Welter — October 2, 2009 @ 9:18 pm
You can save it as a text file and then rename it in Finder.
Comment by xcaper — October 2, 2009 @ 9:54 pm
that isn’t working either. i have x-chat aqua. is that going to make a big difference?
Comment by Jess Welter — October 2, 2009 @ 10:02 pm
So, I’m seeing a few of these:
[00]
[03]
When I look at the code on this site. Does mIRC know what that is? Or do I need to replace that with something?
Thanks!
Comment by J — November 2, 2009 @ 2:56 pm
Just copy and paste from this page into a script by itself in mIRC, it will know what to do.
Comment by xcaper — November 2, 2009 @ 3:25 pm
Type /reloadall in a window and see if it works then.
Comment by xcaper — October 2, 2009 @ 10:12 pm