[script]
n0=; technique lag bar v.09 June 6 2002 for mIRC 5.91, 6.0, 6.01 and above by ex|l- (Ryan) 
n1=; Contact Email: linxsrc@berlin.com Website: http://techniquescript.cjb.net or http://kickme.to/technique
n2=; For my friends and those who want a sweet pic win lagbar with options!
n3=; Thanks to dohcan for tbwin.dll and sample script from which I learned from. :)
n4=; Important note if you ignore notices or ctcps this wont work, depends on the method! <------------------ IMPORTANT
n5=; The script will stop itself if it detects notice or ctcp ignores on yourself! Change your ignore status
n6=; then type /lag.start to turn back on! Ignores on other users wont affect this, just yourself!
n7=; Use the raw method if you have probs with the ignores!
n8=; If you right click on lagbar it has popup and if you close lagbar to turn it back on type /lag.start
n9=; Leave all this code in the same file and make sure tbwin.dll is in script dir or mirc dir!
n10=; This is a bug fix version with oval switch added as well.
n11=
n12=menu @lag.win {
n13=  &color
n14=  .&lag
n15=  ..&red:{ lag.red }
n16=  ..&blue:{ lag.blue }
n17=  ..&green:{ lag.green }
n18=  ..&yellow:{ lag.yellow }
n19=  ..&orange:{ lag.orange }
n20=  ..-
n21=  ..&custom:{ lag.custom }
n22=  .-
n23=  .&text:{ lag.stext }
n24=  .&border:{ lag.sborder }
n25=  .&background:{ lag.sface }
n26=  .-
n27=  .&default values:{ lag.defaults }
n28=  .-
n29=  &delay
n30=  .&current $+($lag.delay,s):{ lag.stime }
n31=  &style
n32=  .$iif($readini($lag.spc($script),lagstuff,oval) == 1,$style(1) &oval,&oval):{ lag.oval.set $iif($readini($lag.spc($script),lagstuff,oval) == 1,0,1) | $lag.style }
n33=  .-
n34=  .$iif($readini($lag.spc($script),lagstuff,style) == small,$style(1) &small,&small):{ lag.style.set small | $lag.style }
n35=  .$iif($readini($lag.spc($script),lagstuff,style) == classic,$style(1) &classic,&classic):{ lag.style.set classic | $lag.style } 
n36=  -
n37=  $iif($active ischan,&say lag):{ lag.msg }
n38=  &method
n39=  .$iif($readini($lag.spc($script),lagstuff,method) == raw,$style(1) &raw,&raw):{ lag.method.raw }
n40=  .$iif($readini($lag.spc($script),lagstuff,method) == ctcp,$style(1) &ctcp,&ctcp):{ lag.method.ctcp }
n41=  .-
n42=  .$iif($readini($lag.spc($script),lagstuff,method) == notice,$style(1) &notice,&notice):{ lag.method.notice }
n43=  $iif($version >= 6.0,&network)
n44=  .&current $lower($scid($timer(.lag.chk).cid).network):{ echo $color(info) -a *** Currently checking your lag on Network: $+($chr(2),$scid($timer(.lag.chk).cid).network,$chr(2)) Server: $+($chr(2),$scid($timer(.lag.chk).cid).server,$chr(2)) }
n45=  -
n46=  &close:{ lag.stop | echo $color(info) -a *** Stopped all lag bar functions, to turn back on type /lag.start }
n47=}
n48=alias -l lag.bar {
n49=  lag.win.size 
n50=  tbwin Attach @lag.win
n51=  var %z = $dll($_tbwin,GetTBInfo,NOT_USED),%w = $gettok(%z,1,32),%h = $gettok(%z,2,32)
n52=  lagbar.size %w %h
n53=  tbwin OnSize /lagbar.size
n54=  lag.update
n55=  window -a @lag.win
n56=}
n57=alias lag.update { if ($window(@lag.win)) { $lag.style } }
n58=alias lag.win.size { window -phB +d @lag.win 0 0 200 22 }
n59=alias lagbar.size { window @lag.win $calc($1 - 195) $int($calc(($2 - 22) / 2)) 200 22 }
n60=alias -l lag.oval.set { writeini -n $lag.spc($script) lagstuff oval $1 }
n61=alias -l lag.oval { return $iif($readini($lag.spc($script),lagstuff,oval) == 1,d)) } 
n62=alias -l lag.style.set { writeini $lag.spc($script) lagstuff style $1 }
n63=alias -l lag.sface { writeini -n $lag.spc($script) lagstuff face $$input(Enter a rgb color/value for the background eg. $+($chr(36),rgb,$chr(40),face,$chr(41)),129) | $lag.style }
n64=alias -l lag.style { return $iif($readini($lag.spc($script),lagstuff,style),$+(lag.,$ifmatch),$+(lag.,classic)) }
n65=alias -l lag.face { return $iif($readini($lag.spc($script),lagstuff,face),$ifmatch,$rgb(face))) } 
n66=alias -l lag.stext {  writeini -n $lag.spc($script) lagstuff text $$input(Enter a rgb color/value for the text eg. $+($chr(36),rgb,$chr(40),text,$chr(41)),129) | $lag.style }
n67=alias -l lag.text { return $iif($readini($lag.spc($script),lagstuff,text),$ifmatch,$rgb(text))) } 
n68=alias -l lag.sborder { writeini -n $lag.spc($script) lagstuff border $$input(Enter a rgb color/value for the border eg. $+($chr(36),rgb,$chr(40),text,$chr(41)),129) | $lag.style }
n69=alias -l lag.border { return $iif($readini($lag.spc($script),lagstuff,border),$ifmatch,$rgb(text))) } 
n70=alias -l lag.defaults { remini $lag.spc($script) lagstuff face | remini $lag.spc($script) lagstuff text | remini $lag.spc($script) lagstuff border | remini $lag.spc($script) lagstuff color | $lag.style }
n71=alias -l lag.classic {
n72=  var %l = $hget(txlag,curlag),%t = Lag: $lag.isms($hget(txlag,curlag))
n73=  drawrect -nrf @lag.win $lag.face 1 0 0 200 22
n74=  drawtext -nro @lag.win $lag.text Tahoma -7 $calc(65 - $int($width(%t, Tahoma, -7))) 7 %t
n75=  drawrect $+(-nr,$lag.oval) @lag.win $lag.border 2 83 3 105 18
n76=  drawrect $+(-nrf,$lag.oval) @lag.win $lag.color 1 85 5 $iif(%l > 10,$iif(%l != ??,101,0),$int($calc(%l * 10.1))) 14
n77=  drawdot @lag.win
n78=}
n79=alias -l lag.small {
n80=  var %l = $hget(txlag,curlag),%t = Lag: $lag.isms($hget(txlag,curlag))
n81=  drawrect -nrf @lag.win $lag.face 1 0 0 200 22
n82=  drawtext -nr @lag.win $lag.text Tahoma -7 $int($calc((110 - $width(%t, Tahoma, -7)) / 2)) 7 %t
n83=  drawrect $+(-nr,$lag.oval) @lag.win $lag.border 1 83 7 105 12
n84=  drawrect $+(-nrf,$lag.oval) @lag.win $lag.color 1 85 9 $iif(%l > 10,$iif(%l != ??,101,0),$int($calc(%l * 10.1))) 8
n85=  drawdot @lag.win
n86=}
n87=alias lag.deploy { 
n88=  if ($1) { writeini -n $lag.spc($script) lagstuff text $1 }
n89=  if ($2) { writeini -n $lag.spc($script) lagstuff border $2 }
n90=  if ($3) { writeini -n $lag.spc($script) lagstuff color $3 }
n91=  if ($4) { writeini -n $lag.spc($script) lagstuff face $4 }
n92=  lag.stop
n93=  lag.start
n94=}
n95=alias lag.scheme { echo $color(info) -a *** technique lag bar scheme settings, pass this to a friend /lag.deploy $lag.text $lag.border $lag.color $lag.face }
n96=on ^*:notice:lag*:?: { 
n97=  if ($nick == $me) && ($2 isnum) && ($hget(txlag)) { 
n98=    hadd txlag curlag $calc($calc($ticks - $2) / 1000) 
n99=    lag.update
n100=    haltdef 
n101=  }
n102=  elseif (!$hget(txlag)) { 
n103=    lag.stop 
n104=    echo $color(info) -a *** Hash table error shutting down lag bar!
n105=    haltdef
n106=  }
n107=}
n108=ctcp *:lag*:?:{ 
n109=  if ($nick == $me) && ($2 isnum) && ($hget(txlag)) {
n110=    hadd txlag curlag $calc($calc($ticks - $2) / 1000)
n111=    lag.update  
n112=    halt 
n113=  }
n114=  elseif (!$hget(txlag)) { 
n115=    lag.stop 
n116=    echo $color(info) -a *** Hash table error shutting down lag bar!
n117=    halt
n118=  }
n119=}
n120=raw 421:*:{
n121=  if ($1 == $me) && ($2 isnum) { 
n122=    if ($hget(txlag)) hadd txlag curlag $calc($calc($ticks - $2) / 1000) 
n123=    lag.update 
n124=    halt
n125=  }
n126=}
n127=alias lag.start {
n128=  if (!$readini($lag.spc($script),lagstuff,method)) { lag.method }
n129=  if (!$hget(txlag)) { 
n130=    hmake txlag 1 
n131=    hadd txlag curlag ?? 
n132=  } 
n133=  lag.bar 
n134=  lag.fill
n135=  lag.chk
n136=}
n137=alias -l lag.method { 
n138=  $iif($input(Would you like to use a notice for lag check if not press no then a ctcp will be used you can also use the raw method from popup!,8,Lag method.),writeini -n $lag.spc($script) lagstuff method notice,writeini $lag.spc($script) lagstuff method ctcp) 
n139=  lag.stop
n140=  $iif($server,lag.start)
n141=}
n142=alias -l _tbwin { 
n143=  if ($isfile($+($scriptdir,tbwin.dll))) {
n144=    return $lag.spc($+($scriptdir,tbwin.dll))
n145=  }
n146=  elseif ($findfile($mircdir,tbwin.dll,1)) {
n147=    return $lag.spc($ifmatch)
n148=  }
n149=  else {
n150=    lag.stop
n151=    .timer.lag.error $iif($version >= 6.0,-i) 2 5 echo $color(info) -a *** Couldn't locate tbwin.dll in your mIRC or script directory, please put tbwin.dll in your mIRC or script directory so lag bar can function!
n152=  }
n153=}
n154=alias -l lag.color { 
n155=  if ($readini($lag.spc($script),lagstuff,color)) {
n156=    return $ifmatch
n157=  }
n158=  else {
n159=    return $rgb(255,0,0)
n160=  }
n161=}
n162=alias -l lag.spc { return $+($chr(34),$1-,$chr(34)) }
n163=alias -l lag.red { writeini -n $lag.spc($script) lagstuff color $rgb(255,0,0) | lag.fill }
n164=alias -l lag.blue { writeini -n $lag.spc($script) lagstuff color $rgb(0,0,255) | lag.fill }
n165=alias -l lag.green { writeini -n $lag.spc($script) lagstuff color $rgb(12,240,30) | lag.fill }
n166=alias -l lag.yellow { writeini -n $lag.spc($script) lagstuff color $rgb(255,255,0) | lag.fill }
n167=alias -l lag.orange { writeini -n $lag.spc($script) lagstuff color $rgb(252,127,0) | lag.fill }
n168=alias -l lag.custom { writeini -n $lag.spc($script) lagstuff color $$input(Enter a custom rgb color/value which you can get by using $+($chr(36),rgb) identifier!,129) | lag.fill }
n169=alias -l tbwin { dll $_tbwin $1- }
n170=alias -l lag.chk { 
n171=  if ($readini($lag.spc($script),lagstuff,method) != raw) {
n172=    .timer.lag.chk $iif($version >= 6.0,-i) 0 $lag.delay $&
n173=      $+(lag.,$readini($lag.spc($script),lagstuff,method)) | lag.ignore.chk
n174=  } 
n175=  else { 
n176=    .timer.lag.chk $iif($version >= 6.0,-i) 0 $lag.delay $+(lag.,$readini($lag.spc($script),lagstuff,method))
n177=  }
n178=} 
n179=alias -l lag.delay { return $iif($readini($lag.spc($script),lagstuff,delay),$ifmatch,20) }
n180=alias lag.stime { 
n181=  writeini -n $lag.spc($script) lagstuff delay $$input(Delay in seconds to check lag recommended 10 or more seconds!,129)
n182=  lag.chk
n183=}
n184=alias -l lag.method.raw { writeini -n $lag.spc($script) lagstuff method raw | lag.stop | $iif($server,lag.start) }
n185=alias -l lag.method.ctcp { writeini -n $lag.spc($script) lagstuff method ctcp | lag.stop | $iif($server,lag.start) }
n186=alias -l lag.method.notice { writeini -n $lag.spc($script) lagstuff method notice | lag.stop | $iif($server,lag.start) }
n187=alias -l lag.ctcp { $iif($server,.ctcp $me lag $ticks) }
n188=alias -l lag.notice { $iif($server,.notice $me lag $ticks) }
n189=alias -l lag.raw { $iif($server,.raw $ticks) }
n190=alias -l lag.isms { if ($1 isnum) { return $+($1,s) } | else { return $1 } }
n191=alias -l lag.msg { $iif($active ischan,msg # Currently my lag is: $lag.isms($hget(txlag,curlag))) }
n192=alias lag.stop { 
n193=  $iif($window(@lag.win),window -c @lag.win)
n194=  .timer.lag.chk off 
n195=  $iif($hget(txlag),hfree txlag)
n196=}
n197=on *:load: { 
n198=  if ($version >= 5.91) { 
n199=    lag.style.set classic
n200=    lag.oval.set 0
n201=    lag.method 
n202=    echo $color(info) -a *** technique lag bar v.09 loaded successfully, right click on lagbar for options! 
n203=  }
n204=  else {
n205=    echo $color(info) -a *** This needs mIRC version 5.91+ this is $version , this addon wont work unloading it!
n206=    .unload -rs " $+ $script $+ "
n207=  }
n208=}
n209=on *:connect:{ 
n210=  if ($version >= 6.0) && (!$window(@lag.win)) { 
n211=    lag.start
n212=  }
n213=  elseif ($version == 5.91) {
n214=    lag.start
n215=  }
n216=}
n217=on *:unload:{ lag.stop | remini $lag.spc($script) lagstuff }
n218=on *:active:*:{ if ($version >= 6.0) && ($timer(.lag.chk)) && ($activecid != $timer(.lag.chk).cid) { scid $activecid lag.chk } }
n219=on *:disconnect:{ 
n220=  if ($version >= 6.0) { 
n221=    var %s = 1,%t 
n222=    while (%s <= $scon(0)) {
n223=      if ($scon(%s).status == connected) { inc %t }
n224=      inc %s
n225=    }
n226=    $iif(!%t,lag.stop)
n227=  }
n228=  elseif ($version == 5.91) {
n229=    lag.stop 
n230=  }
n231=}
n232=alias -l lag.fill {
n233=  if ($hget(txlag)) {
n234=    var %f = 1,%g = 30,%h = $hget(txlag,curlag)
n235=    while (%f <= 10) {
n236=      $+(.timer.lag.fill,$r(1,999)) -h 1 %g hadd txlag curlag %f  
n237=      $+(.timer.lag.fill2,$r(1,9999)) -h 1 $calc(%g + 1) lag.update
n238=      inc %f
n239=      inc %g 30
n240=    }
n241=  }
n242=  if ($hget(txlag)) {
n243=    var %i = 10,%j = 300
n244=    while (%i >= 0) {
n245=      $+(.timer.lag.clr,$r(1,999)) -h 1 %j hadd txlag curlag %i 
n246=      $+(.timer.lag.clr2,$r(1,9999)) -h 1 $calc(%j + 1) lag.update
n247=      dec %i
n248=      inc %j 30
n249=    }
n250=  }
n251=  .timer.lag.restore -h 1 1000 hadd txlag curlag %h
n252=  .timer.lag.restore2 -h 1 1050 lag.update
n253=}
n254=alias -l lag.ignore.chk { 
n255=  if ($ignore($address($me,5))) && (notice isin $ignore($ifmatch).type) && ($readini($lag.spc($script),lagstuff,method) == notice) {   
n256=    .timer.lag.error2 1 5 echo $color(info) -a *** You are ignoring notice's from yourself lag bar wont work,fix then type /lag.start
n257=    lag.stop
n258=  }
n259=  elseif ($ignore($address($me,5))) && (ctcp isin $ignore($ifmatch).type) && ($readini($lag.spc($script),lagstuff,method) == ctcp) {
n260=    .timer.lag.error3 1 5 echo $color(info) -a *** You are ignoring ctcp's from yourself lag bar wont work, fix then type /lag.start
n261=    lag.stop
n262=  }
n263=  elseif ($ignore(*!*@*)) && (notice isin $ignore($ifmatch).type) && ($readini($lag.spc($script),lagstuff,method) == notice) {
n264=    .timer.lag.error4 1 5 echo $color(info) -a *** You are ignoring notice's, your lag bar wont work, fix then type /lag.start
n265=    lag.stop
n266=  }
n267=  elseif ($ignore(*!*@*)) && (ctcp isin $ignore($ifmatch).type) && ($readini($lag.spc($script),lagstuff,method) == ctcp) {
n268=    .timer.lag.error5 1 5 echo $color(info) -a *** You are ignoring ctcps, your lag bar wont work, fix then type /lag.start
n269=    lag.stop
n270=  }
n271=}
n272=
n273=; End of technique lag bar v.09 "Show some technique"
[lagstuff]
style=small
oval=0
method=notice
