Author Topic: mIRC Lag script  (Read 10949 times)

0 Members and 1 Guest are viewing this topic.

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 #15 on: October 15, 2011, 08:24:29 pm »
updating for iambian seeing as he cant acces the spam section?!?!?

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

  echo -a -- Finished setting up scripts 
  server -m irc.servercentral.net
;This is where you add entries to auto-connect to networks
}

on *:CONNECT: {
  set %z.htmp adrnick $+ $network | connecthashmake
  set %z.htmp nickadr $+ $network | connecthashmake
  set %z.htmp chansta $+ $network | connecthashmake
  unset %z.htmp
  togglelagtimer
  if ( $network == EFNet ) {join #omnimaga}
;This is where you customize what you automatically join or do on connection.

}
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
  set %z.htmp chansta $+ $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:*: {
  ;If channel does not exist yet in the database, enable blocking until manually unset.
  if (!$hfind(chansta $+ $network,$chan)) {
    hadd chansta $+ $network $chan i
  }
  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) {
    ;chan stat flag 'i' to ignore (not update hashlist). For really big channels.
    $iif($pos($hget(chansta $+ $network,$chan),i,0),echo $chan Not keeping track of nicks in $chan,.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
  $iif($pos($hget(chansta $+ $network,$chan),i,0),Enable,Disable) Initial Nick Get: togglechantrack $chan



}

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
  Manual Disable Bot Check Startup:togglechantrack $?="Disable Checking For This Channel" 1
}

;########################################################################
; 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 25 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))
}

alias togglechantrack {
  ;$1 = chan name
  ;$iif($pos($hget(chansta $+ $network,$chan),i,0),echo $chan Not keeping track of nicks in $chan,.who $chan)
  if (!$hget(chansta $+ $network,$1)) {
    hadd chansta $+ $network $1 i
  }
  else {
    set %temp $hget(chansta $+ $network,$1)
    if ($pos(%temp,i,0)) { set %temp2 $remove(%temp,i) }
    else {
      set %temp2 %temp $+ i
    }
    if ($2) {
      echo -a Force setting of ignore channel script
      set %temp2 $remove(%temp,1)
      set %temp %temp2
      ;forcing a set of the variable if second argument exists.
      set %temp2 %temp $+ i
    }
    hadd chansta $+ $network $1 %temp2
    unset %temp %temp2
  }

}

Quote from: iambian
         
19:00:01   +Iambian | You should be able to replace this script with the old version without any additional changes.                             
19:00:42   +Iambian | All this does is create an additional hash table that keeps track of settings you've made with any given channel. At the   
                            | moment, there's only one.                                                                                                 
19:01:34   +Iambian | With that, the only other changes made are in the on JOIN event, and the addition of an alias.                             
19:01:58   +Iambian | I've also removed the "raw 303" event if you were actually using that for anything.                                                                                                                         
19:02:23   +Iambian | If you still need it, just copy and paste all four of the short little lines :)        

Offline Netham45

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2103
  • Rating: +213/-4
  • *explodes*
    • View Profile
Re: mIRC Lag script
« Reply #16 on: October 15, 2011, 09:01:57 pm »
updating for iambian seeing as he cant acces the spam section?!?!?

The spam section was restricted to 1000+ post users and staff.

I'd suggest you move this to one of the programming forums.
Omnimaga Admin

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 #17 on: October 15, 2011, 10:45:10 pm »
I always wondered why this was in spam in the first place, unless he wanted to keep it secret?

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: mIRC Lag script
« Reply #18 on: October 16, 2011, 01:39:38 am »
I can move it somewhere else?

EDIT: Did it. :)
« Last Edit: October 16, 2011, 01:41:19 am by Juju »

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.