Author Topic: mIRC Lag script  (Read 10738 times)

0 Members and 1 Guest are viewing this topic.

Offline Iambian

  • Coder Of Tomorrow
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 739
  • Rating: +216/-3
  • Cherry Flavoured Nommer of Fishies
    • View Profile
mIRC Lag script
« on: January 05, 2010, 12:44:52 am »
FULL POST EDIT: Forget what I said earlier. I'm just gonna dump the entire script here. It's what I have and it's what I run. A few things don't work quite yet and some things might get a little annoying, but hey. If you don't want it, just clear it out of your mIRC if you loaded it.

This code goes in the "Remote" section of your scripts. Before you do it, though, make sure something is in the menubar part of your "Popups" section of the scripts. I happen to have just "DevMan" as the first line and that's it, but you can have anything you want. All it does is puts a menu option between your "Tools" and "Window" in the menubar that matches whatever you put in.

Code: [Select]
on *:START: {
  echo -a -- Setting up scripts
  if (!$exists(htabs)) { mkdir htabs }

  echo -a -- Finished setting up scripts  

}

on *:CONNECT: {
  set %z.htmp adrnick $+ $network | connecthashmake
  set %z.htmp nickadr $+ $network | connecthashmake
  unset %z.htmp
}
alias connecthashmake {
  hmake %z.htmp 100
  if ($exists(htabs\ $+ %z.htmp)) { hload %z.htmp htabs\ $+ %z.htmp }
}

on *:DISCONNECT: {
  unset %z.chmod.*. $+ $network
  timer $+ conn $+ $cid off
  set %z.htmp adrnick $+ $network | hsave %z.htmp htabs\ $+ %z.htmp | hfree %z.htmp
  set %z.htmp nickadr $+ $network | hsave %z.htmp htabs\ $+ %z.htmp | hfree %z.htmp
  unset %z.htmp
}

on *:EXIT: {
  echo -a Cleaning up scripts
  unset %z.chmod*
  echo -a Done
}

;Performing who on join allows population of address list checker
;$timestamp
on ^*:JOIN:*: {
  updatehashtable $site $nick
  set %z.htab.adni adrnick $+ $network
  if (($gettok($hget(%z.htab.adni,$site),2,32)) && ($nick != $me)) {
    set %z.htab.time $gettok($hget(%z.htab.adni,$site),3,32)
    set %z.htab.nick $gettok($hget(%z.htab.adni,$site),2,32)
    if ($nick != %z.htab.nick) {
      echo $target  $+ $color(join) $+ $timestamp * $nick has joined $chan $+ , using %z.htab.nick ( $+ $duration($calc($ctime - %z.htab.time)) $+ ) ago.
      haltdef
    }
  }
  unset %z.htab*

  if (($nick != $me ) && ($ialchan($address($nick,2),$chan,0) > 1 )) {
    var %a $ialchan($address($nick,2),$chan,0)
    while (%a) {
      if ($nick != $ialchan($address($nick,2),$chan,%a).nick) {
        set %b %b $ialchan($address($nick,2),$chan,%a).nick
      }
      dec %a
    }
    echo $target  $+ $color(join) $+ $timestamp * $nick has joined $chan $+ , with clones $calc($ialchan($address($nick,2),$chan,0)-1) clone $+ $iif($calc($ialchan($address($nick,2),$chan,0)-1) > 1,s) ( %b ) $address($nick,2)
    unset %b
    haltdef
  }
  if ($nick == $me) {
    .who $chan
    .timerj1 $+ $chan 1 2 .signal joinsect 1 $chan
    .timerj2 $+ $chan 1 2 .signal joinsect 2 $chan
    .timerj3 $+ $chan 1 4 .signal joinsect 3 $chan
    .timerj4 $+ $chan 1 6 .signal joinsect 4 $chan
    set %z.chmod. $+ $chan $+ . $+ $network $iif($nick($chan,0) == 1,3,0)
    ;set %z.chmod. $+ $chan $+ . $+ $network $pos(+%@&~,$left($nick($chan,$me).pnick,1),1)
  }
}

on *:SIGNAL:joinsect: {
  if ($1 == 1) { set %z.chmod. [ $+ [ $2 ] $+ ] . $+ $network $iif($nick($chan,0) == 1,3,0) }
  if ($1 == 2) { mode $2 b }
  if ($1 == 3) { mode $2 e }
  ;  if ($1 == 4) { mode $2 i }
}

on *:NICK: {
  updatehashtable $site $newnick
}

on *:QUIT: {
  updatehashtable $site $nick $ctime
}

on *:PART:*: {
  updatehashtable $site $nick $stime
}


on *:RAWMODE:*: {

  if ($me == $2) {
    ;Sets variable for channel on network for mode number
    set %z.chmod. $+ $chan $+ . $+ $network $pos(+%@&~,$left($nick($chan,$me).pnick,1),1)
  }
}

on ^*:NOTICE:*:*: {

  if (($1 == $me) && ($3 == $null)) {
    echo -a ::: (LAG) : ( $+ $calc($uptime(mirc)-$2) $+ )msec.
    haltdef
  }
  if (($1 == $scid($4).me) && ($3 != $null)) {
    if ($calc($uptime(mirc)-$2) > 10000) {
      echo -a ::: (AUTOLAG WARNING) There is too much lag on ( $+ $3 $+ ). ( $+ $calc($uptime(mirc)-$2) $+ )msec.
    }
    haltdef
  }

}

;########################################################################
; RAW COMMAND INTERCEPTS FOR REMOTE SCRIPT MAINTENANCE

;RPL_WHOREPLY
raw 352:*: {
  if ($chr(35) isin $2) { updatehashtable $4 $6 }

}
;RPL_ENDOFWHO
raw 315:*: {

}


;########################################################################
; MENUS SECTION OF REMOTE SCRIPT


menu nicklist {
  UserInfo
  .Get Info:/uwho $$1
  .Whois:/whois $$1
  .Query:/query $$1
  -
  Controls:
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 4,$iif($nick($chan,$1,q) != $null,Remove Owner,Set Owner)):$listmode(q,$iif($nick($chan,$1,q) != $null,-,+),$chan)
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 3,$iif(& isin $nick($chan,$1).pnick,Remove Protect,Set Protect)):$listmode(a,$iif(& isin $nick($chan,$1).pnick,-,+),$chan)
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 2,$iif($1 isop $chan,Remove Op,Set Op)):$listmode(o,$iif($1 isop $chan,-,+),$chan)
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 2,$iif($1 ishop $chan,Remove HalfOp,Set HalfOp)):$listmode(h,$iif($1 ishop $chan,-,+),$chan)
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 1,$iif($1 isvoice $chan,Remove Voice,Set Voice)):$listmode(v,$iif($1 isvoice $chan,-,+),$chan)
  CTCP/DCC:
  .Get VERSION: ctcp $$1 VERSION
  .Get TIME: ctcp $$1 TIME
  .Get PING: ctcp $$1 PING
  .Custom CTCP: ctcp $$1 $$?="Custom CTCP command:"
  .Chat via DCC: dcc chat $$1
  .Send via DCC: dcc send $$1

}
menu channel {
  Channel Modes: channel
  Channel CTCPs
  .Send PING to $chan : ctcp $chan PING
  .Send TIME to $chan : ctcp $chan TIME
  .Send VERSION to $chan : ctcp $chan VERSION
  Check Lag: .notice $me $me $uptime(mirc)
  Check for clones: clonecheck
}

menu menubar {
  $iif($scid($cid).status == connected,$iif($timer(conn $+ $cid) == $null,Start Lag Timer,Stop Lag Timer)): { $iif($timer(conn $+ $cid) == $null, .timer $+ [ conn $+ [ $cid ] ] 0 30 scid [ [ $cid ] ] .notice $!me $me $!uptime(mirc) $!network $cid, .timer $+ conn $+ $cid off ) | echo -a Timer on $network is now $iif($timer(conn $+ $cid) == $null,Off,On) }
  Output Hash Tables:renderhashtabs

}

menu query {
  Check Lag: .notice $me $me $uptime(mirc)
}

menu status {
  Check Lag: .notice $me $me $uptime(mirc)
  User Modes
  .$iif(i isincs $usermode,Remove User Invisible,Set User Invisible):$iif(i isincs $usermode, mode $me -i, mode $me +i)
  .$iif(p isincs $usermode,Remove Channel Invisible,Set Channel Invisible):$iif(p isincs $usermode, mode $me -p, mode $me +p)
  .$iif(d isincs $usermode,Remove Deaf,Quit listening to channel chatter):$iif(d isincs $usermode, mode $me -d, mode $me +d)
  .$iif(w isincs $usermode,Don't listen to Wallops,Listen to Wallops):$iif(w isincs $usermode, mode $me -w, mode $me +w)
  .$iif(s isincs $usermode,Don't listen to server notices,Listen to server notices):$iif(s isincs $usermode, mode $me -s, mode $me +s)
  .$iif(R isincs $usermode,Allow PRIVMSGs/NOTICEs from Unregistered users,Don't allow PRIVMSGs/NOTICEs from Unregistered users):$iif(R isincs $usermode, mode $me -R, mode $me +R)
  .$iif(T isincs $usermode,Recieve CTCPs,Filter Out CTCPs):$iif(T isincs $usermode, mode $me -T, mode $me +T)
  .$iif(W isincs $usermode,Don't see WHOIS requests,See WHOIS attempts (IRCops Only)):$iif(W isincs $usermode, mode $me -W, mode $me +W)
  Stats
  .Check Banversion (B):stats B
  .Check Bad Words List (b):stats b
  .Check Spam Filter(f):stats f
  .Check G-Line/GZ-Line list:stats g
  .Check K-Line list:stats K
  .Check Oper block list:stats O
  .Check Shun list:stats s
  .Check Traffic list:stats T
  .Check U-Line list:stats U
  .Check V-Host list:stats V



}

;########################################################################
; ALIASES SECTION OF REMOTE SCRIPT

alias massmode { if ( $1 == $null ) { return }
  if ($1 !isin eb) {
    var %_a $nick($3,0)
    unset %_b
    while (%_a) { set %_b %_b $nick($3,%_a) | dec %_a }
    var %_a %_b | unset %_b
    modeall $3 $1 $2 %_a
  }
  else {
    var %_a $nick($3,0)
    unset %_b
    while (%_a) { set %_b %_b $address($nick($3,%_a),2) | dec %_a }
    var %_a %_b | unset %_b
    modeall $3 $1 $2 %_a
  }
}


;Arg1 = string of mode (w/o + or -, one letter ). Arg2 = String of change ( this is + or - ). Arg3 = channel name
alias listmode { if ( $1 == $null ) { return }
  if ($1 !isin eb) {
    var %_a $nick($3,0)
    unset %_b
    while (%_a) { set %_b %_b $snick($3,%_a) | dec %_a }
    var %_a %_b | unset %_b
    modeall $3 $1 $2 %_a
  }
  else {
    var %_a $nick($3,0)
    unset %_b
    while (%_a) { set %_b %_b $address($snick($3,%_a),2) | dec %_a }
    var %_a %_b | unset %_b
    modeall $3 $1 $2 %_a
  }
}

alias modeall {
  var %_a $modespl
  var %_c $calc($0 - 3)
  while ( %_c > 0 ) {
    var %_d %_a
    if ( %_c < %_d ) { var %_d %_c }
    var %_b %_d | var %_g %_c
    while ( %_d != 0 ) {
      var %_e %_e $ [ $+ [ $calc(%_g + 3) ] ]
      dec %_d | dec %_g
    }
    var %_d %_b
    while ( %_d != 0 ) {
      var %_f [ [ %_f ] $+ [ $2 ] ]
      dec %_d
    }
    mode $1 $3 $+ %_f %_e
    unset %_e
    %_c = %_c - %_b
  }
}

;Used in the menubar so I don't clutter that section up
alias renderhashtabs {
  window -x @htabs
  set %z.htab.numtables $hget(0)
  aline @htabs Hash Table Count: %z.htab.numtables
  while (%z.htab.numtables) {
    set %z.htab.itemcount $hget(%z.htab.numtables,0).item
    aline @htabs Hash Table: $hget(%z.htab.numtables)
    aline @htabs ------------------------------------
    while (%z.htab.itemcount) {
      aline @htabs $hget(%z.htab.numtables,%z.htab.itemcount).item : $hget(%z.htab.numtables,%z.htab.itemcount).data
      dec %z.htab.itemcount
    }
    aline @htabs ------------------------------------
    dec %z.htab.numtables
  }
  aline @htabs Done generating tables
  aline @htabs ##########################################
  unset %z.htab*
}

;/updatehashtable <hostmask> <nick>
alias updatehashtable {
  ;Schema: address contains number of long entries
  ;^n^ contains nth entry consisting of up to 10 nicks, preceded by nick count.
  ;
  set %z.htab.adni adrnick $+ $network
  hadd nickadr $+ $network $2 $1
  if (!$gettok($hget(%z.htab.adni,$1),1,32)) {
    hadd %z.htab.adni $1 1
    hadd %z.htab.adni ^1^ $+ $1 1 $2
  }
  else {
    set %z.htab.count $gettok($hget(%z.htab.adni,$1),1,32)
    set %z.htab.verify 0
    while (%z.htab.count) {
      if ($istok($hget(%z.htab.adni, ^ $+ %z.htab.count $+ ^ [ $+ [ $1 ] ]),$2,32) == $true) { set %z.htab.verify 1 }
      dec %z.htab.count
    }
    if (!%z.htab.verify) {
      set %z.htab.tempcnt $gettok($hget(%z.htab.adni,$1),1,32)
      if ($gettok($hget(%z.htab.adni,^ $+ %z.htab.tempcnt $+ ^ [ $+ [ $1 ] ]),1,32) > 25) {
        inc %z.htab.tempcnt
        set %z.htab.temp %z.htab.tempcnt $gettok($hget(%z.htab.adni),2-,32)
        hadd %z.htab.adni $1 %z.htab.temp
      }
      set %z.htab.temp ^ $+ %z.htab.tempcnt $+ ^ [ $+ [ $1 ] ]
      set %z.htab.temp2 $hget(%z.htab.adni,%z.htab.temp)
      hadd %z.htab.adni %z.htab.temp $calc($gettok(%z.htab.temp2,1,32)+1) $gettok(%z.htab.temp2,2-,32) $2
    }
  }
  if ($3) {
    ;sets main with additional about nick on this change
    set %z.htab.temp $gettok($hget(%z.htab.adni,$1),1,32) $2-
    hadd %z.htab.adni $1 %z.htab.temp
  }
  unset %z.htab*
}

alias clonecheck {
  hmake clones 16
  set %z.cc.count $nick($chan,0)
  while (%z.cc.count) {
    set %z.cc.mask $hget(nickadr $+ $network,$nick($chan,%z.cc.count))
    if (!$hget(clones,%z.cc.mask)) {
      hadd clones %z.cc.mask 1 $nick($chan,%z.cc.count)
    }
    else {
      set %z.cc.temp $calc($gettok($hget(clones,%z.cc.mask),1,32) + 1) $nick($chan,%z.cc.count) $gettok($hget(clones,%z.cc.mask),2-,32)
      hadd clones %z.cc.mask %z.cc.temp
    }
    dec %z.cc.count
  }
  set %z.cc.count $hget(clones,0).item
  if (!%z.cc.count) { halt }
  window -x @clones
  aline @clones Nick count: %z.cc.count
  aline @clones ------------------------------------
  while (%z.cc.count) {
    if ($gettok($hget(clones,%z.cc.count).data,1,32) > 1) {
      set %z.cc.temp $hget(clones,%z.cc.count).data
      set %z.cc.tcnt $gettok(%z.cc.temp,1,32)
      set %z.cc.tnik $gettok(%z.cc.temp,2-,32)
      aline @clones %z.cc.tcnt clones ( $+ %z.cc.tnik $+ ) at $hget(clones,%z.cc.count).item
    }
    dec %z.cc.count
  }
  aline @clones ------------------------------------
  unset %z.cc*
  hfree clones
}


EDIT:
UPDATE:  http://ourl.ca/3925/253042
« Last Edit: October 15, 2011, 08:38:02 pm by Geekboy1011 »
A Cherry-Flavored Iambian draws near... what do you do? ...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: mIRC Lag script
« Reply #1 on: January 05, 2010, 07:42:18 pm »
uhm i am confused by what it is supposed to do. Could you exlain in more details the purpose of this script before I put it in my mIRC scripts and accidentally trigger a nuclear holocaust?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: mIRC Lag script
« Reply #2 on: January 05, 2010, 07:43:30 pm »
It causes lag :P

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: mIRC Lag script
« Reply #3 on: January 05, 2010, 07:53:08 pm »
wait, it does it literally? O.o

I thought it was just some sort of joke name and that it did something else, because to be honest, I don't really see why would someone want his mIRC to lag x.x, unless he wants others to lag (which would be malicious)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: mIRC Lag script
« Reply #4 on: January 05, 2010, 07:55:00 pm »
I honestly don't know actually x.x Perhaps it measures the amount of lag that you are experiencing at the time?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: mIRC Lag script
« Reply #5 on: January 05, 2010, 07:57:35 pm »
Maybe that, else I have no clue. I wouldn't mind installing it if I actually could read the code and be able to know what to not type/press to not cause mass chaos in a channel. Since we are on Efnet, which has no ChanServ protection, it is something we need to worry more about. For example, if I accidentally deop the entire channel and CHANFIX fails to recognise the regular ops, we're screwed. Try to get 30 users to not join the channel anymore for a few days and prevent unwanted ones from taking over the chan while everyone else is gone x.x

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: mIRC Lag script
« Reply #6 on: January 05, 2010, 08:03:04 pm »
Yeah, that would be chaos O.O

I use Y-chat though, and it has built in lag detection ^^

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: mIRC Lag script
« Reply #7 on: January 05, 2010, 08:14:45 pm »
Actually, when I check the forums new posts, I use the active threads list and I don't pay attention to which forum the topic is located in sometimes. Now that I noticed this one is in Randomness, maybe it could be a script to literally cause lag, after all :P

And anyone has clue why on Silverex website, there's no reference to Y Chat, just to X-Chat or X-Chat 2.x.x? Even my copy of X-Chat says "X-Chat" in the titlebar and even the about section:

XChat 2.8.4-1

Client IRC multiplateformes

This version is unofficial and comes with no support.

Windows 5.1 [i1586/2,93GHz]
Charset: CP1252 GTK+: 2.10.14
Compiled: Sep 23 2007

© 1998-2007 Peter Železný <[email protected]>
© 2003-2007 Vaidrius Petrauskas <[email protected]>
« Last Edit: January 05, 2010, 08:15:25 pm by DJ Omnimaga »

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: mIRC Lag script
« Reply #8 on: January 05, 2010, 08:21:13 pm »
Yeah, hmmmm.  I know Y-chat is just a cloned version of X-chat, but I also noticed it still was called X-chat in some places, and Y-chat in others ???

They must have forgotten to change some parts of the source they ripped from x-chat XD

Offline Geekboy1011

  • The Oneironaut
  • Donator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2031
  • Rating: +119/-2
  • Dream that Awakening dream
    • View Profile
Re: mIRC Lag script
« Reply #9 on: January 05, 2010, 08:25:59 pm »
oh umm i asked for it basically it tell you weather your experiancing lots of lagg and on top of that it also contains a reconition script

as in if luther left omnimaga and rejoined as omnom

it would say onomnom joined (preiously luther) or woud say if he is a clone to some one ect ) :)


iambian could you possibly explain the other "working" features?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: mIRC Lag script
« Reply #10 on: January 05, 2010, 08:30:14 pm »
oooh ok I see ^^

For recognition I am generally used to just checking hostmasks, though, when someone new joins. All I do is search for the hostmask in the logs. However, since #omnimaga channel userbase is like 50% larger than it used to be a year ago, it can be hard to detect if someone's impersonating someone else.

Offline Iambian

  • Coder Of Tomorrow
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 739
  • Rating: +216/-3
  • Cherry Flavoured Nommer of Fishies
    • View Profile
Re: mIRC Lag script
« Reply #11 on: January 06, 2010, 12:42:37 am »
A small walkthrough of what I have in the script. These will be described as what's on the first line defining the function.

In the on START event, the script sets up a directory for keeping track of various things that go on in the channels, like who joins it, what their host masks are, and what names they've used in the past. The echo's you see there just relay information back to the user. I intended on putting more stuff there, but I just never got around to it.

In the on CONNECT event, it builds hash tables for the network you've connected to. Lists that relate addresses to nicks and nicks to addresses.

The alias "connecthashmake" just makes the file smaller on my end. I'm a freak like that. All it does is reload a previous occurance of the file if it exists (so it remembers stuff from session to session).

The on DISCONNECT event cleans up the script and stashes away the state of these hash tables to file so it can be recalled the next time you load mIRC. These files will just continue to grow as more poeple come in.

The on EXIT event cleans the script up so there's very little in the variables section when mIRC shuts down.

The on JOIN event is where things really get interesting. The first block of text is testing to determine if anyone on the channel has joined under a different nick. The second block performs checks to determine if any newcomer already has a presence in the channel under a same hostmask. This may get annoying if the person joins from some "legit" proxy, like Mibbit. So ignore it if it gets annoying. The last block of text performs actions if you're the one joining a channel. It collects information about the channel so mIRC's internal lists are filled.

The on SIGNAL:joinsect event collects from the third function of the on JOIN event. Can't do everything at once or the server might think you're flooding.

The on NICK/QUIT/PART events record to the hash tables the last thing the person did.

The on RAWMODE event ... uhm. I think I was trying to determine if you obtained a mode change or something. That part remains incomplete.

The on NOTICE is the recipient of the lag timer. It hides certain things from you so you don't get bombarded by messages to yourself. It's also where the autolag warning kicks in.

The raw commands shown next intercept replies to the /who command, which the script automatically performs each time you join a channel. If you get annoyed by the output, you can try putting a "haltdef" after the if statement underneath "raw 352".

The menu nicklist fills out the context menu if you right click on the nicklist. If you can see the options, most of it is self-explanatory.

The menu channel is similar to the nicklist, except it's what shows if you right-click on the channel window. Pretty much self-explanitory there.

The menu menubar shows up in the menubar. The two options let you start the lag timer if you're connected to a server. Each lag timer is different depending on what server window/channels you have active. The "Output Hash Tables" lets you see the contents of the hash tables that are there. Mostly for debugging purposes.

The menu query is self-explanitory. It's what happens if you right-click while in a PM.

The menu status is what happens when you right-click in the status (server/private) window. Lets you set modes on yourself.

Ooookay. The aliases section. All of these aliases are used internally, so don't try to call them yourself.

The massmode alias isn't used but the listmode alias sure is. Lets you apply modes to any you've selected in the nicklist. Supports multiple selections (by Ctrl+click or Shift+click). The modeall alias is called by the previous two aliases to perform the function.

The renderhashtables alias creates a new window and dumps the contents of the hash tables there.

The updatehashtables alieas is a fair bit of work that rebuilds the contents of the hash tables given a newcomer's nick and hostmask. Relations are created in this phase.

The clonecheck alias is used in the menu channel to output the names of any clones (people with the same hostmask) and some of their information, like who's who and what their hostmask is.

And... that's it. I guess.
A Cherry-Flavored Iambian draws near... what do you do? ...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: mIRC Lag script
« Reply #12 on: January 06, 2010, 12:45:32 am »
w00t thanks for explaining ^^

Now I should be able to use this safely once I installed ^^

Offline Iambian

  • Coder Of Tomorrow
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 739
  • Rating: +216/-3
  • Cherry Flavoured Nommer of Fishies
    • View Profile
Re: mIRC Lag script
« Reply #13 on: March 13, 2010, 12:52:35 am »
Update to the script. The lag timer is now automatically enabled and is more resilient to nickchanges.

Code: [Select]
on *:START: {
  echo -a -- Setting up scripts
  if (!$exists(htabs)) { mkdir htabs }

  echo -a -- Finished setting up scripts  
}

on *:CONNECT: {
  set %z.htmp adrnick $+ $network | connecthashmake
  set %z.htmp nickadr $+ $network | connecthashmake
  unset %z.htmp
  togglelagtimer
}
alias connecthashmake {
  hmake %z.htmp 100
  if ($exists(htabs\ $+ %z.htmp)) { hload %z.htmp htabs\ $+ %z.htmp }
}

on *:DISCONNECT: {
  unset %z.chmod.*. $+ $network
  timer $+ conn $+ $cid off
  set %z.htmp adrnick $+ $network | hsave %z.htmp htabs\ $+ %z.htmp | hfree %z.htmp
  set %z.htmp nickadr $+ $network | hsave %z.htmp htabs\ $+ %z.htmp | hfree %z.htmp
  unset %z.htmp
}

on *:EXIT: {
  echo -a Cleaning up scripts
  unset %z.chmod*
  echo -a Done
}

;Performing who on join allows population of address list checker
;$timestamp
on ^*:JOIN:*: {
  updatehashtable $site $nick
  set %z.htab.adni adrnick $+ $network
  if (($gettok($hget(%z.htab.adni,$site),2,32)) && ($nick != $me)) {
    set %z.htab.time $gettok($hget(%z.htab.adni,$site),3,32)
    set %z.htab.nick $gettok($hget(%z.htab.adni,$site),2,32)
    if ($nick != %z.htab.nick) {
      echo $target  $+ $color(join) $+ $timestamp * $nick has joined $chan $+ , using %z.htab.nick ( $+ $duration($calc($ctime - %z.htab.time)) $+ ) ago.
      haltdef
    }
  }
  unset %z.htab*

  if (($nick != $me ) && ($ialchan($address($nick,2),$chan,0) > 1 )) {
    var %a $ialchan($address($nick,2),$chan,0)
    while (%a) {
      if ($nick != $ialchan($address($nick,2),$chan,%a).nick) {
        set %b %b $ialchan($address($nick,2),$chan,%a).nick
      }
      dec %a
    }
    echo $target  $+ $color(join) $+ $timestamp * $nick has joined $chan $+ , with clones $calc($ialchan($address($nick,2),$chan,0)-1) clone $+ $iif($calc($ialchan($address($nick,2),$chan,0)-1) > 1,s) ( %b ) $address($nick,2)
    unset %b
    haltdef
  }
  if ($nick == $me) {
    .who $chan
    .timerj1 $+ $chan 1 2 .signal joinsect 1 $chan
    .timerj2 $+ $chan 1 2 .signal joinsect 2 $chan
    .timerj3 $+ $chan 1 4 .signal joinsect 3 $chan
    .timerj4 $+ $chan 1 6 .signal joinsect 4 $chan
    set %z.chmod. $+ $chan $+ . $+ $network $iif($nick($chan,0) == 1,3,0)
    ;set %z.chmod. $+ $chan $+ . $+ $network $pos(+%@&~,$left($nick($chan,$me).pnick,1),1)
  }
}

on *:SIGNAL:joinsect: {
  if ($1 == 1) { set %z.chmod. [ $+ [ $2 ] $+ ] . $+ $network $iif($nick($chan,0) == 1,3,0) }
  if ($1 == 2) { mode $2 b }
  if ($1 == 3) { mode $2 e }
  ;  if ($1 == 4) { mode $2 i }
}

on *:NICK: {
  if (($nick == $me) && $iif($scid($cid).status == connected,$iif($timer(conn $+ $cid) == $null,0,1),0)) {
    togglelagtimer 1337
    echo -a Cycling LAG TIMER for nickchange
    .signal mynickchanged
  }

  updatehashtable $site $newnick
}

on *:QUIT: {
  updatehashtable $site $nick $ctime
}

on *:PART:*: {
  updatehashtable $site $nick $stime
}


on *:RAWMODE:*: {

  if ($me == $2) {
    ;Sets variable for channel on network for mode number
    set %z.chmod. $+ $chan $+ . $+ $network $pos(+%@&~,$left($nick($chan,$me).pnick,1),1)
  }
}

on ^*:NOTICE:*:*: {

  if (($1 == $me) && ($3 == $null)) {
    echo -a ::: (LAG) : ( $+ $calc($uptime(mirc)-$2) $+ )msec.
    haltdef
  }
  if (($1 == $scid($4).me) && ($3 != $null)) {
    if ($calc($uptime(mirc)-$2) > 10000) {
      echo -a ::: (AUTOLAG WARNING) There is too much lag on ( $+ $3 $+ ). ( $+ $calc($uptime(mirc)-$2) $+ )msec.
    }
    haltdef
  }

}

on *:SIGNAL:mynickchanged: {
  togglelagtimer 1337
}

;########################################################################
; RAW COMMAND INTERCEPTS FOR REMOTE SCRIPT MAINTENANCE

;RPL_WHOREPLY
raw 352:*: {
  if ($chr(35) isin $2) { updatehashtable $4 $6 }

}
;RPL_ENDOFWHO
raw 315:*: {

}

;########################################################################
; MENUS SECTION OF REMOTE SCRIPT


menu nicklist {
  UserInfo
  .Get Info:/uwho $$1
  .Whois:/whois $$1
  .Query:/query $$1
  -
  Controls:
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 4,$iif($nick($chan,$1,q) != $null,Remove Owner,Set Owner)):$listmode(q,$iif($nick($chan,$1,q) != $null,-,+),$chan)
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 3,$iif(& isin $nick($chan,$1).pnick,Remove Protect,Set Protect)):$listmode(a,$iif(& isin $nick($chan,$1).pnick,-,+),$chan)
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 2,$iif($1 isop $chan,Remove Op,Set Op)):$listmode(o,$iif($1 isop $chan,-,+),$chan)
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 2,$iif($1 ishop $chan,Remove HalfOp,Set HalfOp)):$listmode(h,$iif($1 ishop $chan,-,+),$chan)
  .$iif(%z.chmod. [ $+ [ $chan ] $+ . $+ [ $network ] ] > 1,$iif($1 isvoice $chan,Remove Voice,Set Voice)):$listmode(v,$iif($1 isvoice $chan,-,+),$chan)
  CTCP/DCC:
  .Get VERSION: ctcp $$1 VERSION
  .Get TIME: ctcp $$1 TIME
  .Get PING: ctcp $$1 PING
  .Custom CTCP: ctcp $$1 $$?="Custom CTCP command:"
  .Chat via DCC: dcc chat $$1
  .Send via DCC: dcc send $$1

}
menu channel {
  Channel Modes: channel
  Channel CTCPs
  .Send PING to $chan : ctcp $chan PING
  .Send TIME to $chan : ctcp $chan TIME
  .Send VERSION to $chan : ctcp $chan VERSION
  Check Lag: .notice $me $me $uptime(mirc)
  Check for clones: clonecheck
}

menu menubar {
  $iif($scid($cid).status == connected,$iif($timer(conn $+ $cid) == $null,Start Lag Timer,Stop Lag Timer)): togglelagtimer
  Output Hash Tables:renderhashtabs

}

menu query {
  Check Lag: .notice $me $me $uptime(mirc)
}

menu status {
  Check Lag: .notice $me $me $uptime(mirc)
  User Modes
  .$iif(i isincs $usermode,Remove User Invisible,Set User Invisible):$iif(i isincs $usermode, mode $me -i, mode $me +i)
  .$iif(p isincs $usermode,Remove Channel Invisible,Set Channel Invisible):$iif(p isincs $usermode, mode $me -p, mode $me +p)
  .$iif(d isincs $usermode,Remove Deaf,Quit listening to channel chatter):$iif(d isincs $usermode, mode $me -d, mode $me +d)
  .$iif(w isincs $usermode,Don't listen to Wallops,Listen to Wallops):$iif(w isincs $usermode, mode $me -w, mode $me +w)
  .$iif(s isincs $usermode,Don't listen to server notices,Listen to server notices):$iif(s isincs $usermode, mode $me -s, mode $me +s)
  .$iif(R isincs $usermode,Allow PRIVMSGs/NOTICEs from Unregistered users,Don't allow PRIVMSGs/NOTICEs from Unregistered users):$iif(R isincs $usermode, mode $me -R, mode $me +R)
  .$iif(T isincs $usermode,Recieve CTCPs,Filter Out CTCPs):$iif(T isincs $usermode, mode $me -T, mode $me +T)
  .$iif(W isincs $usermode,Don't see WHOIS requests,See WHOIS attempts (IRCops Only)):$iif(W isincs $usermode, mode $me -W, mode $me +W)
  Stats
  .Check Banversion (B):stats B
  .Check Bad Words List (b):stats b
  .Check Spam Filter(f):stats f
  .Check G-Line/GZ-Line list:stats g
  .Check K-Line list:stats K
  .Check Oper block list:stats O
  .Check Shun list:stats s
  .Check Traffic list:stats T
  .Check U-Line list:stats U
  .Check V-Host list:stats V



}

;########################################################################
; ALIASES SECTION OF REMOTE SCRIPT

alias massmode { if ( $1 == $null ) { return }
  if ($1 !isin eb) {
    var %_a $nick($3,0)
    unset %_b
    while (%_a) { set %_b %_b $nick($3,%_a) | dec %_a }
    var %_a %_b | unset %_b
    modeall $3 $1 $2 %_a
  }
  else {
    var %_a $nick($3,0)
    unset %_b
    while (%_a) { set %_b %_b $address($nick($3,%_a),2) | dec %_a }
    var %_a %_b | unset %_b
    modeall $3 $1 $2 %_a
  }
}


;Arg1 = string of mode (w/o + or -, one letter ). Arg2 = String of change ( this is + or - ). Arg3 = channel name
alias listmode { if ( $1 == $null ) { return }
  if ($1 !isin eb) {
    var %_a $nick($3,0)
    unset %_b
    while (%_a) { set %_b %_b $snick($3,%_a) | dec %_a }
    var %_a %_b | unset %_b
    modeall $3 $1 $2 %_a
  }
  else {
    var %_a $nick($3,0)
    unset %_b
    while (%_a) { set %_b %_b $address($snick($3,%_a),2) | dec %_a }
    var %_a %_b | unset %_b
    modeall $3 $1 $2 %_a
  }
}

alias modeall {
  var %_a $modespl
  var %_c $calc($0 - 3)
  while ( %_c > 0 ) {
    var %_d %_a
    if ( %_c < %_d ) { var %_d %_c }
    var %_b %_d | var %_g %_c
    while ( %_d != 0 ) {
      var %_e %_e $ [ $+ [ $calc(%_g + 3) ] ]
      dec %_d | dec %_g
    }
    var %_d %_b
    while ( %_d != 0 ) {
      var %_f [ [ %_f ] $+ [ $2 ] ]
      dec %_d
    }
    mode $1 $3 $+ %_f %_e
    unset %_e
    %_c = %_c - %_b
  }
}

;Used in the menubar so I don't clutter that section up
alias renderhashtabs {
  window -x @htabs
  set %z.htab.numtables $hget(0)
  aline @htabs Hash Table Count: %z.htab.numtables
  while (%z.htab.numtables) {
    set %z.htab.itemcount $hget(%z.htab.numtables,0).item
    aline @htabs Hash Table: $hget(%z.htab.numtables)
    aline @htabs ------------------------------------
    while (%z.htab.itemcount) {
      aline @htabs $hget(%z.htab.numtables,%z.htab.itemcount).item : $hget(%z.htab.numtables,%z.htab.itemcount).data
      dec %z.htab.itemcount
    }
    aline @htabs ------------------------------------
    dec %z.htab.numtables
  }
  aline @htabs Done generating tables
  aline @htabs ##########################################
  unset %z.htab*
}

;/updatehashtable <hostmask> <nick>
alias updatehashtable {
  ;Schema: address contains number of long entries
  ;^n^ contains nth entry consisting of up to 10 nicks, preceded by nick count.
  ;
  set %z.htab.adni adrnick $+ $network
  hadd nickadr $+ $network $2 $1
  if (!$gettok($hget(%z.htab.adni,$1),1,32)) {
    hadd %z.htab.adni $1 1
    hadd %z.htab.adni ^1^ $+ $1 1 $2
  }
  else {
    set %z.htab.count $gettok($hget(%z.htab.adni,$1),1,32)
    set %z.htab.verify 0
    while (%z.htab.count) {
      if ($istok($hget(%z.htab.adni, ^ $+ %z.htab.count $+ ^ [ $+ [ $1 ] ]),$2,32) == $true) { set %z.htab.verify 1 }
      dec %z.htab.count
    }
    if (!%z.htab.verify) {
      set %z.htab.tempcnt $gettok($hget(%z.htab.adni,$1),1,32)
      if ($gettok($hget(%z.htab.adni,^ $+ %z.htab.tempcnt $+ ^ [ $+ [ $1 ] ]),1,32) > 25) {
        inc %z.htab.tempcnt
        set %z.htab.temp %z.htab.tempcnt $gettok($hget(%z.htab.adni),2-,32)
        hadd %z.htab.adni $1 %z.htab.temp
      }
      set %z.htab.temp ^ $+ %z.htab.tempcnt $+ ^ [ $+ [ $1 ] ]
      set %z.htab.temp2 $hget(%z.htab.adni,%z.htab.temp)
      hadd %z.htab.adni %z.htab.temp $calc($gettok(%z.htab.temp2,1,32)+1) $gettok(%z.htab.temp2,2-,32) $2
    }
  }
  if ($3) {
    ;sets main with additional about nick on this change
    set %z.htab.temp $gettok($hget(%z.htab.adni,$1),1,32) $2-
    hadd %z.htab.adni $1 %z.htab.temp
  }
  unset %z.htab*
}

alias clonecheck {
  hmake clones 16
  set %z.cc.count $nick($chan,0)
  while (%z.cc.count) {
    set %z.cc.mask $hget(nickadr $+ $network,$nick($chan,%z.cc.count))
    if (!$hget(clones,%z.cc.mask)) {
      hadd clones %z.cc.mask 1 $nick($chan,%z.cc.count)
    }
    else {
      set %z.cc.temp $calc($gettok($hget(clones,%z.cc.mask),1,32) + 1) $nick($chan,%z.cc.count) $gettok($hget(clones,%z.cc.mask),2-,32)
      hadd clones %z.cc.mask %z.cc.temp
    }
    dec %z.cc.count
  }
  set %z.cc.count $hget(clones,0).item
  if (!%z.cc.count) { halt }
  window -x @clones
  aline @clones Nick count: %z.cc.count
  aline @clones ------------------------------------
  while (%z.cc.count) {
    if ($gettok($hget(clones,%z.cc.count).data,1,32) > 1) {
      set %z.cc.temp $hget(clones,%z.cc.count).data
      set %z.cc.tcnt $gettok(%z.cc.temp,1,32)
      set %z.cc.tnik $gettok(%z.cc.temp,2-,32)
      aline @clones %z.cc.tcnt clones ( $+ %z.cc.tnik $+ ) at $hget(clones,%z.cc.count).item
    }
    dec %z.cc.count
  }
  aline @clones ------------------------------------
  unset %z.cc*
  hfree clones
}

alias togglelagtimer {
  $iif($timer(conn $+ $cid) == $null, .timer $+ [ conn $+ [ $cid ] ] 0 30 scid [ [ $cid ] ] .notice $!me $me $!uptime(mirc) $!network $cid, .timer $+ conn $+ $cid off ) | $iif($1 != 1337,echo -a Timer on $network is now $iif($timer(conn $+ $cid) == $null,Off,On))
}
« Last Edit: March 13, 2010, 12:53:31 am by Iambian »
A Cherry-Flavored Iambian draws near... what do you do? ...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: mIRC Lag script
« Reply #14 on: March 13, 2010, 01:36:58 am »
yay update ^^