esasmetalci Admin
Mesaj Sayısı : 137 Kayıt tarihi : 04/11/09
| Konu: Pixel Araç Addonu Çarş. Kas. 25, 2009 3:50 pm | |
| Pixel Araç Addonu:Scriptlerinde resimlerle uğraşmak isteyenlerin severek kullanacağı Bir pixel araç addonudur. - Kod:
-
/* Pixeltool - by nudalz(at)buttstories(dot)com October 21, 2007 (v1.2) */ ;script alias pt { if (!$2) tokenize 32 20 20 hadd -m pt x $calc($1 *10) hadd pt y $calc($2 *10) hadd pt c $color(15) window -Cdfk0pw0 +ft @Pixeltool -1 -1 $calc($hget(pt,x) +30) $pt.y drawrect -fr @Pixeltool $rgb(250,250,250) 1 0 0 $window(@Pixeltool).x $window(@Pixeltool).y drawrect -fr @Pixeltool $color(0) 1 0 0 $calc($hget(pt,x) +30) $hget(pt,y) pt.title | pt.ui | pt.grid $1 $2 } alias -l pt.re { hadd pt x $calc($1 *10) hadd pt y $calc($2 *10) window -fp @Pixeltool -1 -1 $calc($hget(pt,x) +30) $pt.y pt.ui pt.grid $1 $2 } alias -l pt.title { renwin @Pixeltool @Pixeltool $iif($1-,- $1-,- Untitled) } alias -l pt.ui { drawrect -fr @Pixeltool $rgb(250,250,250) 1 0 0 30 $pt.y var %c = 0, %n = 1, %x = 4, %y = 3 while (%n <= 8) { drawrect -r @Pixeltool $rgb(100,100,100) 1 %x %y 10 10 drawfill -r @Pixeltool $color(%c) $rgb(100,100,100) $calc(%x +1) $calc(%y +1) inc %x 12 inc %c drawrect -r @Pixeltool $rgb(100,100,100) 1 %x %y 10 10 drawfill -r @Pixeltool $color(%c) $rgb(100,100,100) $calc(%x +1) $calc(%y +1) dec %x 12 inc %y 12 inc %c inc %n } drawrect -r @Pixeltool $rgb(100,100,100) 1 7 100 16 16 drawfill -r @Pixeltool $hget(pt,c) $rgb(100,100,100) 8 101 drawtext -r @Pixeltool $rgb(100,100,100) terminal 7 2 $calc($pt.y -35) V $+ $pt.ver drawtext -r @Pixeltool $rgb(100,100,100) terminal 7 6 $calc($pt.y -17) x: $+ $calc($hget(pt,x) /10) drawtext -r @Pixeltool $rgb(100,100,100) terminal 7 6 $calc($pt.y -8) y: $+ $calc($hget(pt,y) /10) } alias -l pt.grid { var %c = $rgb(235,235,235), %x = 0, %y = 0 while (%y <= $1) { drawline -r @Pixeltool %c 1 $calc((%y *10) +30) 0 $calc((%y *10) +30) $hget(pt,y) inc %y } while (%x <= $2) { drawline -r @Pixeltool %c 1 30 $calc(%x *10) $calc($hget(pt,x) +30) $calc(%x *10) inc %x } } alias -l pt.draw { if ($inrect($2,$3,30,0,$hget(pt,x),$hget(pt,y))) drawfill -r @Pixeltool $hget(pt,c) $rgb(235,235,235) $2 $3 elseif ($inrect($2,$3,0,0,29,$hget(pt,y))) { var %a = $getdot(@Pixeltool,$2,$3) if ((%a == $rgb(100,100,100)) || (%a == $rgb(235,235,235)) || (%a == $rgb(250,250,250))) halt else { hadd pt c %a drawfill -r @Pixeltool %a $rgb(100,100,100) 10 102 } } } alias -l pt.thumb { window -hpw0 +df @pt 0 0 $calc(($hget(pt,x) /10) +2) $calc(($hget(pt,y) /10) +2) var %a, %b = 0, %x, %y = 1 while (%y <= $hget(pt,y)) { %a = 0 %x = 31 while (%x <= $calc($hget(pt,x) +30)) { drawdot -r @pt $getdot(@Pixeltool,%x,%y) 1 %a %b inc %x 10 inc %a } inc %y 10 inc %b } drawsave -b32 @pt $+(",$iif($gettok($$1-,2,46) != bmp,$$1- $+ .bmp,$$1-),") close -@ @pt } alias -l pt.load { var %c = $chr(35), %f = $$1-, %l = 1, %o, %y = 1 pt $len($strip($read(%f,1))) $lines(%f) pt.title $nopath(%f) while ($read(%f,%l)) { noop $regex(c,$pt.lf($v1),/(\d{1,2}\.\d{1,2})/g) noop $regex(l,$pt.lf($v1),/(#+)/g) var %x = 31, %m = 1, %n = 1 while (%m <= $regml(c,0)) { %o = 1 while (%o <= $len($regml(l,%n))) { drawfill -r @Pixeltool $color($gettok($regml(c,%m),1,46)) $rgb(235,235,235) %x %y inc %x 10 inc %o } inc %n inc %m } inc %y 10 inc %l } } alias -l pt.save { if ($1 == 1) { var %f = $$2- | if ($isfile(%f)) write -c $+(",%f,") | if ($numtok($nopath(%f),46) == 1) %f = $+(%f,.txt) | pt.title $nopath(%f) } else var %f = $$2 var %c = $chr(35), %o, %s, %t, %x, %y = 1 while (%y <= $hget(pt,y)) { %x = 31 while (%x <= $calc($hget(pt,x) +30)) { %t = $pt.c($getdot(@Pixeltool,%x,%y)) if (%o == %t) %s = %s $+ %c else %s = $+(%s,$chr(3),%t,$chr(44),%t,%c) %o = %t if (%x == $calc($hget(pt,x) +21)) { if ($1 == 1) write $+(",%f,") %s else msg %f %s unset %s unset %o } inc %x 10 } inc %y 10 } } ;misc fixing aliases alias -l pt.ver { return 1.20 } alias -l pt.y { return $iif($hget(pt,y) < 200,200,$v1)) } alias -l pt.c { var %c = 0 | while (%c <= 15) { if ($1 == $color(%c)) { return %c | break } | inc %c } } alias -l pt.lf { return $replace($$1-,$chr(44),$chr(46),$chr(3),$null) } alias -l pt.rclick { ;rclick fix hadd pt cur-x $calc($ceil($calc($mouse.x /10)) -3) hadd pt cur-y $ceil($calc($mouse.y /10)) } ;menu/dialog/init menu @Pixeltool { mouse:{ if ($hget(pt,m)) pt.draw $hget(pt,c) $mouse.x $mouse.y if ($inrect($mouse.x,$mouse.y,31,1,$hget(pt,x),$hget(pt,y)) == $true) drawtext -bcr @Pixeltool $rgb(100,100,100) $rgb(250,250,250) terminal 7 2 $calc($pt.y -26) 27 6 $+($base($calc($ceil($calc($mouse.x /10)) -3),10,10,2),$chr(44),$base($ceil($calc($mouse.y /10)),10,10,2)) else drawtext -bcr @Pixeltool $rgb(100,100,100) $rgb(250,250,250) terminal 7 2 $calc($pt.y -26) 27 6 ??? } sclick:{ hinc pt m | pt.draw $hget(pt,c) $mouse.x $mouse.y } uclick:hdel pt m leave:{ hdel pt m | drawtext -bcr @Pixeltool $rgb(100,100,100) $rgb(250,250,250) terminal 7 2 $calc($pt.y -26) 27 6 ??? } $pt.rclick New .20x20:{ close -@ @Pixeltool | pt 20 20 } .30x30:{ close -@ @Pixeltool | pt 30 30 } .50x50:{ close -@ @Pixeltool | pt 50 50 } .Custom:{ if ($regex($input(Enter in values for X Y (i.e. 75 50),e,Pixeltool - New),/^(\d+\s\d+)$/)) { close -@ @Pixeltool | pt $regml(1) } } .- .To X,Y ( $+ $+($hget(pt,cur-x),$chr(44),$hget(pt,cur-y)) $+ ):{ var %x = $hget(pt,cur-x), %y = $hget(pt,cur-y) close -@ @Pixeltool pt %x %y } .Same Size ( $+ $+($calc($hget(pt,x) /10),$chr(44),$calc($hget(pt,y) /10)) $+ ):{ var %x = $calc($hget(pt,x) /10), %y = $calc($hget(pt,y) /10) close -@ @Pixeltool pt %x %y } Resize .20x20:pt.re 20 20 .30x30:pt.re 30 30 .50x50:pt.re 50 50 .Custom:if ($regex($input(Enter in values for X Y (i.e. 75 50),e,Pixeltool - Resize),/^(\d+\s\d+)$/)) pt.re $regml(1) .- .To X,Y ( $+ $+($hget(pt,cur-x),$chr(44),$hget(pt,cur-y)) $+ ):pt.re $hget(pt,cur-x) $hget(pt,cur-y) Fill Grid .With Selected Colour:{ var %x, %y = 1 while (%y <= $hget(pt,y)) { %x = 31 while (%x <= $calc($hget(pt,x) +30)) { drawfill -r @Pixeltool $hget(pt,c) $rgb(235,235,235) %x %y inc %x 10 } inc %y 10 } } - Save Thumbnail .*.bmp:pt.thumb $sfile($mircdirpt\ *.bmp,Save As,Save) Edit Saved .txt:if ($sfile($mircdirpt\ *.txt)) run $+(",$v1,") - Load Art:pt.load $sfile($mircdirpt\ *.txt,Load Art,Load) Save Art:pt.save 1 $sfile($mircdirpt\ *.txt,Save As,Save) } menu status,menubar { Piksel Araç .Piksel Araç aç $pt.ver $+ :pt .Play Current Art (to $active $+ ):pt.save 2 $active .Play Saved Art (to $active $+ ) $+ ...:if ($sfile($mircdirpt\ *.txt)) .play $active $+(",$v1,") .- .Check for Updates:pt.update } dialog pt.update { title "Pixeltool Update" size -1 -1 127 68 option dbu text "Current Version:", 1, 1 2 42 8, right text "Latest Version:", 2, 1 12 42 8, right box "Log", 3, 1 20 125 46 button "PTDB", 4, 96 11 30 10 button "Check", 5, 65 11 30 10 edit "", 6, 44 1 20 10, disable edit "", 7, 44 11 20 10, disable list 8, 4 27 119 36, size vsbar } on *:dialog:pt.update:init:0:did -a pt.update 6 $pt.ver on *:dialog:pt.update:sclick:5:pt.sock on *:dialog:pt.update:sclick:4:run http://buttstories.com/pt/ on *:dialog:pt.update:close:0:{ sockclose pt | .timerpt off } on *:close:@Pixeltool:hfree pt on *:load:mkdir pt ;sockets alias -l pt.update { dialog -m pt.update pt.update } alias -l pt.sock { sockclose pt sockopen pt buttstories.com 80 .timerpt 1 15 did -a pt.update 8 Unable to connect to ptdb. did -b pt.update 5 did -a pt.update 5 Checking } on *:sockopen:pt:{ sockwrite -n pt GET /pt/ver.txt HTTP/1.1 sockwrite -n pt Host: buttstories.com sockwrite -n pt $crlf .timerpt off did -a pt.update 5 Check did -a pt.update 8 Connected; checking for a new version... } on *:sockread:pt:{ if ($sockerr) { did -a pt.update 8 sockerr (verchk): $v1 | return } var %v sockread %v tokenize 32 %v if ($1 == v) { hadd -m pt ver $2 did -a pt.update 7 $2 if ($2 > $pt.ver) { did -b pt.update 5 did -a pt.update 8 New version available: $2 ( $+ $3 $+ ). did -a pt.update 8 Click PTDB to view updates & download. var %a = 1 } else did -a pt.update 8 No new version available. } } ;eof | |
|