mIRC Homepage

Help with Code

Posted By: asmodeo

Help with Code - 25/01/08 02:31 AM

Hi all!
Iīm looking for a code but I need some help.

The result of code was this:
* bill4ever (BILL@7CE5D45C.BCBC22D.41D03C39.IP) has joined in #myroom ( before joined like bill_4 )

The Code notify me if one user has joined #myroom before with different nick.
Is possible? confused

Thanks smile
Posted By: sparta

Re: Help with Code - 25/01/08 08:09 AM

You looking for a clone scanner?
Code:
on *:join:#: {
  if (%clones == on) {
    if ($ial($wildsite,0) != 1) {
      if (($ial($wildsite,1).nick ison $chan) && ($ial($wildsite,2).nick ison $chan)) {
        echo -i21 # $timestamp Clone join $ial($wildsite,1).nick - $ial($wildsite,2).nick - $address : $+($chan,.)
        if ($ial($wildsite,5) != $null) { 
          set %clones off | .timer 1 6 set %clones on
        }
      }
    }
  }
}

something like this? the %clones are used to prevent flooding off, if you want to disable the scanner, then type: /set %clones off
Posted By: asmodeo

Re: Help with Code - 25/01/08 02:14 PM

Hi all!
Hi sparta,
Thanks you, but I donīt looking for a clone scanner. shocked

The Code notify me if one user has joined #myroom before with different nick.
The result of code was this:
* bill4ever (BILL@7CE5D45C.BCBC22D.41D03C39.IP) has joined in #myroom ( before joined like bill_4 )

Imagine that bill_4 was joined 1 hour ago, and parted. After, the same user, but with different nick, has joined again.

Iīm sorry, but my englishīs not very good. blush I hope you understand me. smile

Thanks very much
Posted By: LostShadow

Re: Help with Code - 25/01/08 04:21 PM

Yes, declare a variable for every nick on join event to a matching $address($nick,N). Then, if the user joins with a different nick but same host, loop for all the variables with the same matching $address($nick,N), then if the nick of the variable is different, echo it for the on join.

And then there should be alternate methods like hash tables and such.

The problem is, how long do you want mIRC to store every nick and host? For example, if you stored it for 30 seconds, then someone part/joining on a new nick, within 30 seconds, your mIRC can detect. And what would be the point for storing them forever.
Posted By: asmodeo

Re: Help with Code - 25/01/08 04:43 PM

Hi all!
Hi LostShadow,
yeah, thereīs the idea. laugh I want that mIRC stored it for 1 hour. And the registry in .txt file Writing host and nick

I try with $read and $address($nick,2)in part & join event, but doesnīt work good.

Some example code, please? This isnīt easy to do... frown What else?

Thanks very much.

Posted By: LostShadow

Re: Help with Code - 25/01/08 06:35 PM

Okay, I will write this script since I want it to myself.

What annoys me is if someone parts the channels I'm in, then pms me. Then I have to scroll at what channels this person parted from. So storing the variables for an hour should do it. I've always wanted to write a script for that.

The only option is when a user parts/quits all channels you're in, mIRC removes them from your IAL. If there is a way to prevent that, that would be great. But I got no response.

Be back.
Posted By: RoCk

Re: Help with Code - 25/01/08 06:36 PM


No there is no way to prevent that.
Posted By: LostShadow

Re: Help with Code - 25/01/08 06:43 PM

So this is untest.

Code:
on *:part:#: {
  /set -u3600 %jnick $+ $nick $address
}

on *:join:#: {
  var %i = 0
  while (%i <= $var($eval(% $+ jnick $+ $nick $+ *),0)) {
    inc %i
    if ($address == $var($eval(% $+ jnick $+ $nick $+ *),%i).value) {
      if ($nick !iswm $remove($var($eval(% $+ jnick $+ $nick $+ *),%i),$chr(37),jnick)) && ($remove($var($eval(% $+ jnick $+ $nick $+ *),%i),$chr(37),jnick) !iswm $nick) {
        /echo $chan $nick joined previously as $remove($var($eval(% $+ jnick $+ $nick $+ *),%i),$chr(37),jnick) $+ .
      }
    }
  }
}


Several things.

So in your variables sheet, you will see things like:

%jnickNeal $address
%jnickasmodeo <Your $address>

I understand a lot of peole may use %variables for nicks, so this won't cause that duplication confusion.

I also use the %bnickNick $banmask, so... a jnick works perfect for me.

Also, I didn't want to have something like..

Someone-Away has joined channel.
Someone-Away previously joined as Someone.

Or even Someone`.

Or Someone``.

So, I used the !iswm check for sure.

So it will only work if the new nick is not in the old and the old is not in the new - so totally random new nick.

Now I'll use this for my own p.m. event to check if no comchans, then for part chans. May even store one for on quit event. smirk
Posted By: DJ_Sol

Re: Help with Code - 25/01/08 07:16 PM

If I used that I would have hundreds of variables with hundreds of timers going at once.

I have chosen to log nicks on join in a hash table,ini file or MySql db. Then I can reference their gate and see what nickname they used. If it is different they are a clone!
Posted By: LostShadow

Re: Help with Code - 25/01/08 07:20 PM

Intresting concept of saying the -u<Number> is a timer. That true guys?
Posted By: asmodeo

Re: Help with Code - 25/01/08 08:53 PM

Hi all! smile

Iīm test and not work good.
After, I try with this code but, Why wasnīt ok?

Code:
on *:KICK:#:{
  set -u3600 %jnick $+ $site $knick
}
on *:PART:#:{
  set -u3600 %jnick $+ $site $nick
}
on *:QUIT:{
  set -u3600 %jnick $+ $site $nick
}
;=========
on *:JOIN:#:{
  if $site == $remove($var($eval(% $+ jnick $+ $site),1),$chr(37),jnick) && $nick != $var($eval(% $+ jnick $+ $site),1).value {
   echo $chan *** $nick joined previously as $var($eval(% $+ jnick $+ $site),1).value
  }
}


Some Idea?

Thanks very much smile

Posted By: LostShadow

Re: Help with Code - 25/01/08 10:03 PM

Had to test.

Perfect.

Got it all fixed.

Had to to debug a lot.

[January 25 2008 Friday 04:02:57 PM] * testtest (Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com) has left #mIRC
[January 25 2008 Friday 04:03:01 PM] * testtest (Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com) has joined #mIRC
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var Laptop@24-148-19-135.fld-bsr1.chi-fld.il.cable.rcn.com
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var user@worst.vhost.ever
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var ~ohiostate@cpe-65-25-6-203.neo.res.rr.com
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var GoPJirc@Wood.Raptors.own.everything
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var Yeti@c-76-104-160-116.hsd1.wa.comcast.net
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var thomasmoor@PurpleSurge-3DF4C379.freedom2surf.net
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var SPPGuest61@PurpleSurge-DFB169D3.dsl.alice.nl
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var POGEYMANZ@I.leik.chickenz
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var SPPGuest87@D96113C0.71BC860E.FBC68ECF.IP
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var CallOnMe@PurpleSurge-A0CED28D.kntncmtc01.kstnnc.ab.dh.suddenlink.net
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var Ebola@rawr.rawr.fight.the.power
add Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com var Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com
yes4
testtest joined previously as Neal`.

Wohoo!
Posted By: LostShadow

Re: Help with Code - 25/01/08 10:06 PM

This is not supposed to happen.

[January 25 2008 Friday 04:04:33 PM] * testtest (Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com) has left #mIRC
[January 25 2008 Friday 04:04:39 PM] * testtest (Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com) has joined #mIRC
testtest joined previously as Neal`.
[January 25 2008 Friday 04:05:01 PM] * testtest (Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com) has left #mIRC
[January 25 2008 Friday 04:05:08 PM] * Nealtest (Laptop@PurpleSurge-33290AF8.fld-bsr1.chi-fld.il.cable.rcn.com) has joined #mIRC
Nealtest joined previously as Neal`.

Not sure why the 2nd echo's.

But I'll fix it later.

Code:
on *:part:#: {
  /set -u3600 %jnick $+ $nick $address
}

on *:join:#: {
  var %i = 0
  while (%i <= $var($eval(% $+ jnick $+ *),0)) {
    inc %i
    if ($address == $var($eval(% $+ jnick $+ *),%i).value) {
      if ($nick !iswm $remove($var($eval(% $+ jnick $+ *),%i),$chr(37),jnick)) && ($remove($var($eval(% $+ jnick $+ *),%i),$chr(37),jnick) !iswm $nick) {
        /echo $chan $nick joined previously as $remove($var($eval(% $+ jnick $+ *),%i),$chr(37),jnick) $+ .
      }
    }
  }
}


Edit: And the flip side of this script is, it will show you your previous nick when *you* join the channel. Heh.
Posted By: asmodeo

Re: Help with Code - 25/01/08 11:55 PM

Itīs perfect. Nice code LostShadow smile Thanks you very much.

Quote:
Not sure why the 2nd echo's.

Becouse code must unset previously nick īs variable when it finish.

Code:
on *:join:#: {
  var %i = 0
  while (%i <= $var($eval(% $+ jnick $+ *),0)) {
    inc %i
    if ($address == $var($eval(% $+ jnick $+ *),%i).value) {
      if ($nick !iswm $remove($var($eval(% $+ jnick $+ *),%i),$chr(37),jnick)) && ($remove($var($eval(% $+ jnick $+ *),%i),$chr(37),jnick) !iswm $nick) {
        /echo $chan $nick joined previously as $remove($var($eval(% $+ jnick $+ *),%i),$chr(37),jnick) $+ .
;I think so
      unset %jnick $+ $remove($var($eval(% $+ jnick $+ *),%i),$chr(37),jnick)
      }
    }
  }
}


Thanks again

Nice day smile
Posted By: DJ_Sol

Re: Help with Code - 26/01/08 04:43 AM

Originally Posted By: LostShadow
Intresting concept of saying the -u<Number> is a timer. That true guys?


/set [-snzeuN] <%var> [value]

This sets the value of %var to the specified value.

If you specify the -uN switch, %var is unset after N seconds, assuming it is not set again by another script. If you specify a zero for N, the variable is unset when the script finishes.

Posted By: LostShadow

Re: Help with Code - 26/01/08 04:59 PM

Yea, but the way I understand is, /.timers are off-track with time.

If mIRC does a /.timer for every -uN switch then I guess they are just as much off-track in duration.
Posted By: LostShadow

Re: Help with Code - 26/01/08 08:39 PM

Okay here's what I got.

Code:
on *:part:#: {
  /set -u3600 %jnick $+ $nick $address
  if ($comchan($nick,0) == 1) {
    /set -u3600 %pnick $+ $nick $comchan($nick,1)
  }
}

on *:quit:#: {
  /set -u3600 %qnick $+ $nick $address
}

(My kick event)
  if ($knick != $me) && ($nick != $me) && ($nick != ChanServ) {
    /set -u3600 %knick $+ $nick $chan
  }

on *:open:?:*: {
  if ($comchan($nick,0) > 0) {
    var %x = 1, %y 
    while (%x <= $comchan($nick,0)) { 
      %y = %y $comchan($nick,%x)
      if ($nick($comchan($nick,%x),0) == 2) && ($me isop $comchan($nick,%x)) && ($nick isreg $comchan($nick,%x)) && (m !isincs $chan($comchan($nick,%x)).mode) && ($left($1,1) != $chr(33)) {
        if (!$istok(%friend,$nick,44)) { /ban -u250 $comchan($nick,%x) $nick 2 | /kick $comchan($nick,%x) $nick Considering you have pm'd me while we are in this empty channel (just me an you), there was no need to p.m. me. Problem solved. }
      }
      inc %x 
    }
    if ($comchan($nick,1)) { /echo $nick $address %y }
  }
  if ($comchan($nick,0) == 0) {
    var %i = 0
    while (%i <= $var($eval(% $+ pnick $+ *),0)) {
      inc %i
      if ($nick == $remove($var($eval(% $+ pnick $+ *),%i),$chr(37),jnick)) {
        /echo $chan $nick parted previously at $var($eval(% $+ pnick $+ *),%i).value $+ .
      }
    }
    while (%i <= $var($eval(% $+ qnick $+ *),0)) {
      inc %i
      if ($nick == $remove($var($eval(% $+ qnick $+ *),%i),$chr(37),jnick)) {
        /echo $chan $nick quit previously at $var($eval(% $+ qnick $+ *),%i).value $+ .
      }
    }
    while (%i <= $var($eval(% $+ knick $+ *),0)) {
      inc %i
      if ($nick == $remove($var($eval(% $+ knick $+ *),%i),$chr(37),jnick)) {
        /echo $chan $nick quit previously kicked at $var($eval(% $+ knick $+ *),%i).value $+ .
      }
    }
  }
  /splay BatteryLow
}


My question is for the 3 while loops, checking for pnick, qnick, and knick. Will the while loops go 1 by 1 consecutively (wait for the 1st to finish, then start the 2nd), or will it perform all 3 at once? Meaning, the 3rd will start before the 1st will finish?
Posted By: Riamus2

Re: Help with Code - 26/01/08 09:12 PM

mIRC can only do one thing at a time... you cannot loop 3 different loops simultaneously.
Posted By: asmodeo

Re: Help with Code - 27/01/08 05:15 AM

Hi all!
Thisīs "my" final Code. Itīs Ok, perfect!
Thanks for all! wink

Code:
on *:part:#:{
   if *.MindForge.org !iswm $site {
     set -eu3600 %Previous $+ $nick $site
  }
}
on *:QUIT:{
   if *.MindForge.org !iswm $site {
     set -eu3600 %Previous $+ $nick $site
  }
}
on *:KICK:#:{
   if *.MindForge.org !iswm $gettok($address($knick,1),2,64) {
     set -eu3600 %Previous $+ $knick $gettok($address($knick,1),2,64)
  }
}
;========================================================
ON ^*:JOIN:#:{
  If $nick == $me { echo $chan $timestamp * Join on $chan | haltdef | halt }
  else {
    var %i = 0
    while (%i <= $var($eval(% $+ Previous $+ *),0)) {
      inc %i
      if ($site == $var($eval(% $+ Previous $+ *),%i).value) {
        if ($nick != $remove($var($eval(% $+ Previous $+ *),%i),$chr(37),Previous)) {
          echo $chan $timestamp * $nick ( $replace( $+ $address $+ ,@,12@) 12) has joined (14joined previously as $remove($var($eval(% $+ Previous $+ *),%i),$chr(37),Previous) $+ )
          splay Notify
          goto end 
        }
      }
    }
  echo $chan $timestamp * $nick ( $replace( $+ $address $+ ,@,12@) ) has joined
 }
 :end
 haltdef
}
;========================================================
on *:DISCONNECT:{ 
   unset %Previous*
}


Thanks very much again cool

Nice day smile
© 2019 mIRC Discussion Forums