Mircinizin en sağ köşesine uyarlanmış güzel bir lag bar.
Code yurt dışı sitesinden alıntıdır.
Paylaşım amacı birisinin işine yarar düşüncesi.
Code Sahibi : C. Syem
Kod
alias -l rlagb {
return $gettok($readini(lagbar.ini,Bardisplay,bardisp),$1,42)
}
alias -l rlagt {
return $readini(lagbar.ini,lagtextdisplay,lagtext)
}
alias -l hl {
return $hget(lag,$1)
}
alias lag.opt dialog $iif($dialog(lag^),-v,-m) lag^ lag^
alias lag.start {
if (!$istok(disconnected connecting,$status,32)) {
.timerlag.check. $+ $cid 0 10 /lagcheck
lagcheck
}
}
alias lag.off {
if (!$istok(connecting disconnected,$status,32)) && ($hl($+(lag.,$cid))) {
.timerlag.check. $+ $cid off
hdel lag $+(lag.,$cid)
toolbar -d lag
}
}
alias lag {
if ($hl($+(lag.,$cid))) say My lag on $network is currently $v1 $+ !
else echo -atceg info * /lag: check is not currently in effect. Type /lag.start to begin
}
alias -l lagcheck {
if (!$isfile($qt(lagbar.ini))) || ($numtok($rlagb(1-),42) != 3) || ($rlagt !isnum 10-11) {
writeini lagbar.ini Bardisplay bardisp 65280*0*1
writeini lagbar.ini lagtextdisplay lagtext 10
}
hadd -m lag $cid $+ ticks $ticks
.raw ping $ticks
}
alias -l upd.win.lag {
if ($window(@lag)) window -c @lag
window -fhip +d @lag -1 -1 100 20
drawfill -r @lag $rgb(face) $rgb(face) 0 0
}
on ^*:PONG:{
haltdef
var %l $calc($ticks - $hl($+($cid,ticks)))
hdel lag $+($cid,ticks)
if ($activecid == $cid) {
upd.win.lag
drawrect -fr @lag $rlagb(1) 1 0 0 $round($calc(%l /10),0) 20
hadd -m lag $+(lag.,$cid) $iif($rlagt == 10,$calc(%l / 1000) s, %l ms)
drawtext -or @lag $rlagb(2) Tahoma 10 $replace($rlagb(3),2,15) 1 Lag: $hl($+(lag.,$cid))
if (!$toolbar(lag)) toolbar -a lag $qt(Lag) @lag 0 0 100 16 "/lag.opt" @lag
else toolbar -p lag @lag 0 0 100 16
}
}
menu @lag {
Options:lag.opt
Update lag:lagcheck
-
Stop:lag.off
}
on *:active:*:{
if ($hl(lastcid) != $cid) {
if (!$istok(connecting disconnected,$status,32)) && ($hl($+(lag.,$cid))) { lagcheck }
else {
if ($istok(connecting disconnected,$status,32)) {
upd.win.lag
if (!$toolbar(lag)) toolbar -a lag $qt(Lag) @lag 0 0 100 16 "/lag.opt" @lag
drawtext -or @lag $rlagb(2) Tahoma 10 1$replace($rlagb(3),2,15) : Bağlı değil.
toolbar -p lag @lag 0 0 100 16
}
else if ($toolbar(lag)) toolbar -d lag
}
}
hadd -m lag lastcid $cid
}
on *:connect:lag.start
on *:disconnect:{
lag.off
window -c @lag
}
on *:exit:{
window -c @lag
.timerlag.check.* off
}
on *:unload:{
window -c @lag
.timerlag.check.* off
}
dialog lag^ {
title "Lagbar options [/lag.opt]"
size -1 -1 113 60
option dbu
box "Colors", 1, 3 1 109 26
text "Lag bar:", 2, 6 8 76 8
text "Text:", 3, 6 16 76 8
button "!", 4, 89 8 14 8
button "!", 5, 89 17 14 8
box "Text display", 6, 2 26 109 33
text "Align:", 7, 7 35 25 8
combo 8, 33 34 29 50, size drop
text "Display as:", 9, 6 46 30 8
check "Seconds", 10, 40 45 31 10
check "Milliseconds", 11, 72 45 38 10
}
on *:dialog:lag^:init:0:{
didtok $dname 8 32 Left Center
if ($isfile($qt(lagbar.ini))) {
did -a $dname 2 Lag bar: $rlagb(1)
did -a $dname 3 Text: $rlagb(2)
did -c $dname 8 $rlagb(3)
did -c $dname $rlagt
}
}
on *:dialog:lag^:sclick:*:{
;// Lagbar color & Text alignment
if ($did isin 238) writeini lagbar.ini Bardisplay bardisp $+($remove($did($dname,2).text,Lag bar:),*,$remove($did($dname,3).text,Text:),*,$did($dname,8).sel)
;// Time display
if ($did isnum 10-11) {
did -c $dname $did
did -u $dname $replacex($did,10,11,11,10)
writeini lagbar.ini lagtextdisplay lagtext $did
}
if ($did isnum 4-5) {
set %lagcoledit $calc($did -3)
if ($dialog(lag~)) dialog -x lagcol
dialog -m lagcol lagcol
}
}
on *:dialog:lag^:close:0:lagcheck
alias -l updRGB {
window -ph @lag~col
drawfill -r @lag~col $rgb($1,$2,$3) 1 1 1
drawsave @lag~col lagcol.bmp
window -c @lag~col
did -g lagcol 7 lagcol.bmp
.remove lagcol.bmp
}
dialog lagcol {
title "Colors editor "
size -1 -1 105 52
option dbu
text "Red", 1, 4 7 25 8
text "Green", 2, 4 15 25 8
text "Blue", 3, 4 23 25 8
scroll "", 4, 30 7 71 8, range 0 255 horizontal bottom
scroll "", 5, 30 15 71 8, range 0 255 horizontal bottom
scroll "", 6, 30 23 71 8, range 0 255 horizontal bottom
icon 7, 2 32 24 13
button "Set", 8, 64 34 37 12
}
on *:dialog:lagcol:init:0:{
tokenize 44 $rgb($rlagb(%lagcoledit))
did -c $dname 4 $1
did -c $dname 5 $2
did -c $dname 6 $3
updRGB $1-3
}
on *:dialog:lagcol:scroll:*:updRGB $did($dname,4).sel $did($dname,5).sel $did($dname,6).sel
on *:dialog:lagcol:sclick:8: {
writeini lagbar.ini Bardisplay bardisp $puttok($rlagb(1-),$rgb($did($dname,4).sel,$did($dname,5).sel,$did($dname,6).sel),%lagcoledit,42)
if ($dialog(lag^)) {
did -ra lag^ 2 Lag bar: $rlagb(1)
did -ra lag^ 3 Text: $rlagb(2)
}
dialog -x $dname
}
on *:dialog:lagcol:close:0:unset %lagcoledit
The script is working without DLL and will show a lagbar in toolbar. The problem is will apear another window lagbar in the middle of screen and will Restore all other windows. If you look in the script the lagbar windows is suppose to pe invisible (-h):
alias -l upd.win.lag {
if ($window(@lag)) window -c @lag
window -fhip +d @lag -1 -1 100 20
drawfill -r @lag $rgb(face) $rgb(face) 0 0
}