alright another snippet :)
Usage: /prog percent
where percent is a number between 0-100 (no decimal numbers with "." in it)
It creates a small window with a progressbar drawn with the standart commands for a picwin that displays the current progress
to close the window again use /prog -c
if you don't like the colors: you can easily change them by changin the $rgb() identifiers in the snippet
i'll give a little example about the usage in the comment section :)
also you can move the window by clicking on it, holding the mousebutton down and moving the mouse
like usual keep the credits when you want to use it in a public script
P.S.: yes i know there are progressbars for mirc like mdx etc...
but i thought it could be useful e.g. if you have a small script and don't want to use mdx for a single progressbar only
;/prog picwin progressbar Snippet by Nerd on #geeks.chat @ Quakenet
alias prog {
if (!$window(@snip.progress)) { window -ohpdC +dL @snip.progress 0 0 153 24 }
drawrect -fr @snip.progress $rgb(0,0,255) 1 3 3 144 16
if (($1 isnum 0-100) && (. !isin $1)) {
var %percent $round($calc($1 / 10 - 1),1)
var %max $gettok(%percent,1,46)
var %unco $gettok(%percent,2,46)
}
elseif ($1 == -c) { window -c @snip.progress | return }
else { return }
var %y 0
while (%y <= %max) {
drawrect -fr @snip.progress $rgb(0,150,0) 1 $calc(6 + %y * 14) 6 10 10
inc %y
}
if (%unco) { drawrect -fr @snip.progress $rgb(0,150,0) 1 $calc(6 + (%max + 1) * 14) 6 %unco 10 }
drawtext -r @snip.progress $rgb(0,0,0) Fixedsys 10 58 3 $1 $+ %
}
alias move@snip.progress { if ($window(@snip.progress)) { window @snip.progress $calc($mouse.dx - $1) $calc($mouse.dy - $2) | if ($mouse.key & 1) { .timer@snip.progress -o 1 0 move@snip.progress $1- } } }
menu @snip.progress {
sclick:{ move@snip.progress $calc($mouse.dx - $window(@snip.progress).x) $calc($mouse.dy - $window(@snip.progress).y) }
}