mIRC Homepage
Posted By: Deep3D How to add , into script - 05/03/10 01:41 PM
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
    }
  }
}
Posted By: Riamus2 Re: How to add , into script - 05/03/10 02:09 PM
Use $addtok().


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

Posted By: Deep3D Re: How to add , into script - 05/03/10 09:34 PM
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?
Posted By: Riamus2 Re: How to add , into script - 06/03/10 01:38 AM
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
    }
  }
}
Posted By: chacha Re: How to add , into script - 06/03/10 01:54 PM
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
Posted By: Deep3D Re: How to add , into script - 10/03/10 05:53 AM
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.
Posted By: RusselB Re: How to add , into script - 10/03/10 07:06 AM
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.
Posted By: Horstl Re: How to add , into script - 10/03/10 01:08 PM
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
Posted By: Deep3D Re: How to add , into script - 10/03/10 07:15 PM
Cheers to you both! It works just how I want it, perfect.
Posted By: chacha Re: How to add , into script - 10/03/10 09:14 PM
$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 }
}
Posted By: Horstl Re: How to add , into script - 10/03/10 09:40 PM
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).
Posted By: chacha Re: How to add , into script - 10/03/10 10:23 PM
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
Posted By: chacha Re: How to add , into script - 10/03/10 10:43 PM
and i forget to tell u about $gettok(%cnicks,1--2,32) that dont work for any version of mIRC
Posted By: Riamus2 Re: How to add , into script - 10/03/10 10:49 PM
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).
Posted By: chacha Re: How to add , into script - 10/03/10 10:59 PM
@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) ?
Posted By: Riamus2 Re: How to add , into script - 10/03/10 11:20 PM
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.
Posted By: chacha Re: How to add , into script - 10/03/10 11:31 PM
sorry about my english i dont speak verry well :p
Posted By: Horstl Re: How to add , into script - 12/03/10 01:27 PM
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.

Posted By: chacha Re: How to add , into script - 12/03/10 05:09 PM
i asked about $len($nick) > 2 why did u put it?
Posted By: Horstl Re: How to add , into script - 13/03/10 01:20 AM
See "Second edit" in This post smirk
© mIRC Discussion Forums