; -------------------------------------- ; $Progressbar && $Colorbar v1.0 - by Flobse ; ; This snippet create a progressbar and save it in a .jpg file. ; It does also allow a color gradient for the bar. ; The script is splitted in two aliases which you can combine, or just use one of them. ; The $colorbar alias just create the real progressbar with 100% filled. You can use it as single to create a color gradient picture. ; The $progressbar alias create to the .jpg file that u set as $1 just a background and border arround it, write the text (support colorcodes) and cut it to X percent. ; So you can use also other .jpg's than the $colorbar to create a Frame for a .jpg file. (Then use as <%> 100) ; ; ; Have Fun! ; ; -------------------------------------- ; Syntax for $Colorbar: $colorbar(,,,,)[.dbu] ; Note: Colors have to be in the $rgb() format. I recommend .jpg as file format. ; ; Syntax for $Progressbar: $Progressbar(,,,,,,<%>,[,,,]) ; ; -------------------------------------- ; Examples: ; ; //run $progressbar($colorbar($rgb(0,255,0),$rgb(255,0,0),200,20,example.jpg),$rgb(180,180,180),3,5,$rgb(0,0,0),$rgb(50,50,50),75,75%,0,Tahoma,14) ; ; //run $progressbar(MyPic.jpg,$rgb(120,120,180),10,15,$rgb(0,0,0),0,100) ; ; //run $colorbar($rgb(0,0,0),$rgb(0,0,255),300,100,example.jpg) ; ; -------------------------------------- ; ## #Flobse @ Quakenet - Scripter@Flobse.de - UIN: 152759920 ## alias colorbar { ;$colorbar(,,,,)[.dbu] var %w $calc($3 * $iif($prop == dbu,$dbuw,1) -1), %h $calc($4 * $iif($prop == dbu,$dbuh,1)), %f $5, %r $calc($6 * $iif($prop == dbu,$dbuw,1)), %bg $7, %win @colorbar.win if ($isfile($5)) { .remove $qt($5) } if ($window(%win)) { window -c $v1 } window -Bfhdpw0 +d %win -1 -1 %w %h tokenize 44 $+($rgb($1),$chr(44),$rgb($2)) var %x 0, %r $1, %g $2, %b $3, %iR $abs($calc(($1 - $4) / %w)), %iG $abs($calc(($2 - $5) / %w)), %iB $abs($calc(($3 - $6) / %w)) while (%x <= %w) { drawline -r %win $rgb(%r,%g,%b) 1 %x 0 %x %h inc %x $iif($1 < $4,inc,dec) %r %iR $iif($2 < $5,inc,dec) %g %iG $iif($3 < $6,inc,dec) %b %iB } drawsave -b32q100 %win $qt(%f) window -c %win return %f } alias Progressbar { ;$pb.pbar(,,,,,,<%>,[,,,]) if ($exists($1)) { var %pw $pic($1).width, %ph $pic($1).height, %w $calc(%pw + (($3 + $4) *2)), %h $calc(%ph + (($3 + $4) *2)), %win @pb.pbar.picwin if ($window(%win)) { window -c $v1 } window -Bfhdpw0 +d %win -1 -1 %w %h drawfill -r %win $2 $2 0 0 drawpic %win $calc($3 + $4) $calc($3 + $4) $qt($1) var %bs $calc($3 /2) drawline -r %win $5 $3 %bs %bs $calc(%w - %bs) %bs $calc(%w - %bs) $calc(%h - %bs) %bs $calc(%h - %bs) %bs %bs var %x $calc(%pw + $3 + $4 -1), %y $calc($3 + $4) var %mx $calc(((%pw /100) * $7) + $3 + $4) while (%x > %mx) { drawline -r %win $6 1 %x %y %x $calc(%y + %ph) dec %x } if ($8 != $null) { var %x $calc((%pw - $width($8,$10,$11)) /2 + $3 + $4) var %y $calc(%ph /2) drawtext -pr %win $9 $10 $11 %x %y $8 } drawsave -b32q100 %win $qt($scriptdirtemp.jpg) window -c %win return $qt($scriptdirtemp.jpg) } else { echo -sc info * /pb.bar: File not found. } }