|
Joined: Dec 2004
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Dec 2004
Posts: 18 |
Hello, I got a clone script from somewhere and it works very nicely. The only issue with this one seems to be that as I start mirc and auto join channels, it doesnt start it's checks. Only when new clones arrive or I join a channel manually: Here's the script
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; clonespot & control snippet by portse
; this snippet matches clone sets in a
; channel and colors them differently
; in the nicklist, allowing you to easily
; distinguish and control them from the
; nicklist thereafter via a "clone" popup
; note: this script may not work properly
; with other scripts that alter the colors
; of certain nicknames in a channel
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; raws to halt data from a /who
raw 352:*:halt
raw 315:*:halt
; as you join channels, this'll check for clones,
; display them, and color them; works the same if
; clones join any channels that you may be on
on 1:JOIN:#:{
if (!$ial) .ial on
if ($nick == $me) { %chanx = $chan | who %chanx | .timer [ $+ [ $ticks ] ] 1 3 ccheck }
if ($nick != $me) {
%chan = $chan
%addy = $wildsite
%clones = $cclone(%addy,%chan)
if (%clones) {
if (!$hget(color,%addy)) {
%colornum = $iif(%colornum == 11,1,$calc(%colornum + 1))
%usecolor = $gettok(3.4.6.7.8.9.10.11.12.13.14,%colornum,46)
}
var %y = 1
while (%y <= $numtok(%clones,32)) {
cline $iif($hget(color,%addy),$ifmatch,%usecolor) %chan $gettok(%clones,%y,32)
inc %y
}
if (!$hget(color,%addy)) hadd -m color %addy %usecolor
echo -bf %chan (4clones): %clones
hfree clone
}
unset %chan %addy %clones %usecolor
}
}
; ccheck is the alias called to check for clones
; as you join channels
alias -l ccheck {
var %x = 1
while (%x <= $nick(%chanx,0)) {
%addyx = $address($nick(%chanx,%x),2)
%clones = $cclone(%addyx,%chanx)
if (%clones) {
if (!$hget(color,%addyx)) {
%colornum = $iif(%colornum == 11,1,$calc(%colornum + 1))
%usecolor = $gettok(3.4.6.7.8.9.10.11.12.13.14,%colornum,46)
}
var %y = 1
while (%y <= $numtok(%clones,32)) {
cline $iif($hget(color,%addyx),$ifmatch,%usecolor) %chanx $gettok(%clones,%y,32)
inc %y
}
if (!$hget(color,%addyx)) hadd -m color %addyx %usecolor
echo -bf %chanx (4clones): %clones
}
inc %x
}
if ($hget(clone)) hfree clone
unset %chanx %addyx %clones %usecolor
}
; $cclone([addy],[chan]) is what i used to
; loop thru any clone matches and append them to
; a variable that i could use later
alias -l cclone {
if ($ialchan($1,$2,0) >= 2) && (!$hget(clone,$1)) {
var %x = 1
while ($ialchan($1,$2,%x)) {
var %c.l = $addtok(%c.l,$ialchan($1,$2,%x).nick,32)
hadd -m clone $1 %c.l
inc %x
}
}
return $iif(%c.l,$ifmatch,$null)
}
; as clones leave, are kicked or quit irc; we
; need to uncolor the remaining match (if 1)
; so i assigned the required data to variables
; that i use later in the nocl alias
on 1:PART:#:{ if ($ialchan($wildsite,#,0) >= 2) { %c.w = $wildsite | %c.c = $chan | .timer [ $+ [ $ticks ] ] 1 1 nocl } }
on 1:KICK:#:{ if ($ialchan($wildsite,#,0) >= 2) { %c.w = $address($knick,2) | %c.c = $chan | .timer [ $+ [ $ticks ] ] 1 1 nocl } }
on 1:QUIT:{ if ($comchan($nick,0) > 0) { var %x = 1 | while ($comchan($nick,%x)) { %c.c = $comchan($nick,%x) | inc %x } } | if ($ialchan($wildsite,%c.c,0) >= 2) { %c.w = $wildsite | .timer [ $+ [ $ticks ] ] 1 1 nocl } | else unset %c.* }
; the nocl alias loops thru each channel you're
; on, and uncolors any existing clone matches, if
; only one still remains
alias -l nocl {
var %x = 1
while ($chan(%x)) {
if ($ialchan(%c.w,$chan(%x),0) == 1) {
cline -r $chan(%x) $ialchan(%c.w,$chan(%x),1).nick
}
inc %x
}
unset %c.*
}
; the menu below adds a "clone" function to your
; nicklist popup (if the selected nick is a clone)
; the clone function simply allows some control over
; clones in a channel, but will not be enabled if
; you're unopped in the channel
menu nicklist {
.$iif($ialchan($address($$1,2),#,0) >= 2,$iif($me isop #,clone,$style(2) clone),$null)
..ban:{ ban # $$1 2 | var %x = 1 | while ($ialchan($address($$1,2),#,%x)) { kick # $ialchan($address($$1,2),#,%x).nick clones aren't permitted | inc %x } }
..kick
...set:{ var %x = 1 | while ($ialchan($address($$1,2),#,%x)) { kick # $ialchan($address($$1,2),#,%x).nick clones aren't permitted | inc %x } }
...clone:{ kick # $$1 clones aren't permitted }
}
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
After joining a channel, the script stores the current chan in a variable %chanx and waits 3 seconds to receive the "who list" (= all the addresses of the users in the channel) from the server. Now, if you autojoin many chans at once, 3 seconds may be insufficient (not all replies for "/who #" have been reveiced yet). And %ccheck will be overwritten by every channel you join in that 3 seconds. Not to alter the code too much, here's a modification of the upper part. I hope you find the part to replace with the new code, starting and ending with 2 comments you find in the original code. It *should* take now multiple chans into account (storing a string of tokens = channels in variable %chanx instead) and triggering the "you joined: color nicklist" clonecheck at the moment the /who reply has finished (raw 315) instead of a 3 seconds timer.
; raws to halt data from a /who
raw 352:*: {
if ($istok(%chanx,$2,9)) { haltdef }
}
raw 315:*: {
if ($istok(%chanx,$2,9)) { ccheck $2 | haltdef }
}
; as you join channels, this'll check for clones,
; display them, and color them; works the same if
; clones join any channels that you may be on
on *:JOIN:#:{
if (!$ial) { .ial on }
if ($nick == $me) { %chanx = $addtok(%chanx,$chan,9) | who $chan }
else {
var %clones = $cclone($wildsite,$chan)
if (%clones) {
if (!$hget(color,$wildsite)) {
%colornum = $iif(%colornum == 11,1,$calc(%colornum + 1))
var %usecolor = $gettok(3.4.6.7.8.9.10.11.12.13.14,%colornum,46)
}
var %y = 1
while (%y <= $numtok(%clones,32)) {
cline $iif($hget(color,$wildsite),$ifmatch,%usecolor) $chan $gettok(%clones,%y,32)
inc %y
}
if (!$hget(color,$wildsite)) { hadd -m color $wildsite %usecolor }
echo -bf $chan (4clones): %clones
hfree clone
}
}
}
; ccheck is the alias called to check for clones
; as you join channels
alias -l ccheck {
var %x = 1
while (%x <= $nick($1,0)) {
var %addyx = $address($nick($1,%x),2), %clones = $cclone(%addyx,$1)
if (%clones) {
if (!$hget(color,%addyx)) {
%colornum = $iif(%colornum == 11,1,$calc(%colornum + 1))
var %usecolor = $gettok(3.4.6.7.8.9.10.11.12.13.14,%colornum,46)
}
var %y = 1
while (%y <= $numtok(%clones,32)) {
cline $iif($hget(color,%addyx),$ifmatch,%usecolor) $1 $gettok(%clones,%y,32)
inc %y
}
if (!$hget(color,%addyx)) { hadd -m color %addyx %usecolor }
echo -bf $1 (4clones): %clones
}
inc %x
}
if ($hget(clone)) { hfree clone }
%chanx = $remtok(%chanx,$1,1,9)
}
; $cclone([addy],[chan]) is what i used to
I didn't test it, though
Last edited by Horstl; 14/11/08 08:04 AM.
|
|
|
|
Joined: Dec 2004
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Dec 2004
Posts: 18 |
yup, thx: it works for autojoin of 4 channels
|
|
|
|
|