mIRC Home    About    Download    Register    News    Help

Print Thread
#219124 05/03/10 01:41 PM
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
How to add , on the end of eatch clone, but not the last one.

e.g: (clones 3: me1, me2, me3) and not (clones 3: me1, me2, me3,)

Code:
on ^!*:join:#:{
  if %join.clone.scan == on {
    var %x_match = ( $+ $ialchan($address($nick,2),#,0) clone $+ $iif($ialchan($address($nick,2),#,0) > 1,s) $+ :
    var %x = $ialchan($address($nick,2),#,0) , %nicks
    if (%x > 1) { 
      while (%x) { %nicks = %nicks $ialchan($address($nick,2),#,%x).nick | dec %x }
    }
    %xnicks = %nicks $+ )
    if $me !isin %xnicks {
      echo -ltc join # * $nick ( $+ $address $+ ) has joined # 5 $+ $iif( $ialchan($address($nick,2),#,0) > 1 , %x_match %xnicks )
      haltdef
    }
  }
}

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Use $addtok().


Code:
  while (%x) { %nicks = $addtok(%nicks,$ialchan($address($nick,2),#,%x).nick,44) | dec %x }



Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
Cheers! How do I get space between the nicks? (clones 2: nick, nick)

Edit:
How to remove the joinnick from the echo? And remove the number..

Old: (clones 2: me,nick)
New: (clone: nick) and if more clones, change clone to clones:
New +s: (clones: nick, nick2)

Second Edit:
The nick must be over 2 chars long to show clone echo, how?

Last edited by Deep3D; 05/03/10 11:05 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
on ^!*:join:#:{
  if %join.clone.scan == on && $len($nick) > 2 {
    var %x_match = ( $+ clone $+ $iif($ialchan($address($nick,2),#,0) > 1,s) $+ :
    var %x = $ialchan($address($nick,2),#,0) , %nicks
    if (%x > 1) { 
      while (%x) { %nicks = $addtok(%nicks,$ialchan($address($nick,2),#,%x).nick,44) | dec %x }
    }
    %xnicks = $replace(%nicks,$chr(44),$chr(44) $+ $char(32)) $+ )
    if $me !isin %xnicks {
      echo -ltc join # * $nick ( $+ $address $+ ) has joined # 5 $+ $iif( $ialchan($address($nick,2),#,0) > 1 , %x_match %xnicks )
      haltdef
    }
  }
}


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
hi
1- if you already have the space, use $left
2- $address($nick,2) = $wildsite
3- $ial dont work always if u join channel and many user is present the ial dont see them u have to do when u join /who
4- u can use $regsubex

so the code will be like this
Code:
on ^*:join:#:{
  if $nick == $me { set -e %/who $+ # 1 | who # }
  else {
    if %join.clone.scan == on {
      if $ialchan($wildsite,#,0) > 1 {
        echo -ltc join # * $nick ( $+ $address $+ ) has joined # 5 $+ $+($chr(40),$v1 clone(s) $left($regsubex($str(.,$v1),/./g,$+($ialchan($wildsite,#,\n).nick,$chr(44),$chr(32))),-2),$chr(41))
        haltdef
      }
    }
  }
}
raw *:*:{
  if (($numeric == 352) && ($($+(%,/who,$2),2))) haltdef
  elseif ($numeric == 315) && ($($+(%,/who,$2),2)) { unset %/who $+ $2 | haltdef }
}


*RAW is for stop scrolling the command /who avery join


WorldDMT
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
dag1=me

Now:
* dag3 (dag@*.no) has joined #dag (clones: dag3,dag2,dag1)

I would like to see:
Quote:
* dag3 (dag@*.no) has joined #dag who is a clone of dag2 and dag1

Lets say dag4 joined:
* dag4 (dag@*.no) has joined #dag who is a clone of dag3, dag2 and dag1

So remove the nick that joins from the echo.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Replace the echo with
Code:
echo -ltc join # * $nick ( $+ $address $+ ) has joined # 5 $+ $+($chr(40),$v1 clone(s) $remove($left($regsubex($str(.,$v1),/./g,$+($ialchan($wildsite,#,\n).nick,$chr(44),$chr(32))),-2),$nick),$chr(41))


Personally I don't like having code that looks like that, but I'm not willing to chance putting it into smaller sections and breaking the regex.

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Code:
on ^!*:join:#:{
  if (%join.clone.scan == on) && ($len($nick) > 2) && ($ialchan($wildsite,#,0) > 1) {
    var %x = $calc($v1 -1), %n = 1, %cnicks 
    while ($ialchan($wildsite,#,%n).nick) {
      if ($v1 != $nick) { var %cnicks = %cnicks $v1 }
      inc %n
    }
    if (%x > 1) { var %cnicks = $replace($gettok(%cnicks,1--2,32),$chr(32),$+($chr(44),$chr(32))) and $gettok(%cnicks,-1,32) }
    echo -ltc join # * $nick ( $+ $address $+ ) has joined # who is a clone of %cnicks
    haltdef
  }
}

Blind guess 'bout the >and< thing. Anyhow I suggest to eventually settle on a final layout... wink

Last edited by Horstl; 10/03/10 01:19 PM.
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
Cheers to you both! It works just how I want it, perfect.

Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
$ial cant work befor event so when he join he have to /who #chan or else $ial can't work for the present nicks when he joined chan

e.g: if i join chan and 20 nicks r there $ial can't see these 20 nicks u have to /who chan before

so u have to use /who #chan

and about this
Originally Posted By: Deep3D
Lets say dag4 joined:
* dag4 (dag@*.no) has joined #dag who is a clone of dag3, dag2 and dag1


u can do it into $regsubex too then u have 2 codes here

Horstl code: 444 bytes (without /who and raw)
WorldDMT code: 429 bytes and u can do smallest too

Code:
on ^*:join:#:{
  if $nick == $me { set -e %/who $+ # 1 | who # }
  else {
    if %join.clone.scan == on {
      if $ialchan($wildsite,#,0) > 1 {
        var %x $left($regsubex($str(.,$v1),/./g,$+($ialchan($wildsite,#,\n).nick,$chr(44),$chr(32))),-2)
        echo -ltc join # * $nick ( $+ $address $+ ) has joined # 5 $+ $+($chr(40),$(},$v1) clone(s) $&
        $replace(%x,$mid(%x,$pos(%x,$chr(44),$pos(%x,$chr(44),-1)),2), $chr(32) and $right($mid(%x,$pos(%x,$chr(44),$pos(%x,$chr(44),-1)),2),-1)),$chr(41))
        haltdef
      }
    }
  }
}
raw *:*:{
  if (($numeric == 352) && ($($+(%,/who,$2),2))) haltdef
  elseif ($numeric == 315) && ($($+(%,/who,$2),2)) { unset %/who $+ $2 | haltdef }
}


WorldDMT
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
It is not necessarily the case that a script of less bytes will perform better (i.e. faster). Readability put aside, $reg* for example is computationally quite intensive.

You're right regarding $chan().ial, but this really depends on the purpose of the script...
Myself, I'd check for .inwho in any case (imagine 3 other scripts doing their "on me join who #" each), and - if you really need your internal lists updated right after join - swap the task into a separate script, with a queue system (imagine 10+ chans in autojoin and touchy flood-settings of the network).

Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
Originally Posted By: Horstl
if you really need your internal lists updated right after join - swap the task into a separate script, with a queue system (imagine 10+ chans in autojoin and touchy flood-settings of the network).

yeah sure or else he will never get better result


WorldDMT
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
and i forget to tell u about $gettok(%cnicks,1--2,32) that dont work for any version of mIRC


WorldDMT
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: chacha
and i forget to tell u about $gettok(%cnicks,1--2,32) that dont work for any version of mIRC


Oh? Try it.

//echo -a $gettok(This is just some random sentence to use as an example.,1--2,32)

That outputs word 1 through the second word from the end (an) as expected (mirc 6.35).


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
@Riamus2: mIRC 6.32 & 6.35
but if u have 6.21 that will return only the first word

@Horstl: why u put the condition $len($nick > 2) ?


WorldDMT
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, didn't understand your wording then. "that dont work for any version" made me think you meant it didn't work in any version... meaning no versions work with that method. I see that you meant that it doesn't work in every version.

In either case, it works fine if the person is on a newer version of mIRC and not distributing the script to others. Though subtracting X tokens from the total number works too. And that's usually how I do it.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
sorry about my english i dont speak verry well :p


WorldDMT
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Deep3D asked for a minimum nicklen in the third post. And usually I tend to care for compatiblity only with, say, the last or second last version. smile

Originally Posted By: versions.txt
21/05/2008 - mIRC v6.32
[...]
22.Fixed handling of negative range values in token identifiers.


Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
i asked about $len($nick) > 2 why did u put it?


WorldDMT
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
See "Second edit" in This post smirk


Link Copied to Clipboard