launch your mIRC and copy/paste the code in remote section ( Alt+R ), click OK and type /star3d
enjoy :)
;#starfield3d - BombStrike
;maybe a little slow, buy a big CPU yaaaaa !!!! :P
;shut down all running apps and type /star3d
;access to star3d has table
alias -l a return $hget(star3d,$+($1,$prop))
alias -l b hadd star3d $1 $2
;on load mouaaaahahahahh >_<
on *:load:echo -a /star3d [width] enjoy ! ( if you specify [width], the height will be calc to fit 4/3 format )
;main aliase
alias star3d {
;set all vars
%wh = 0 0 800 600 | %a = @star3d | %mxet = 50 | %fps = 0 | %ofps = 0 | %m = drawdot -nr %a | %l = drawtext -rn @star3d 16777215 Verdana 9 | %whx = 400 | %why = 300
;interactivity ? :P
if ($1 isnum) { %wh = 0 0 $1 $calc($1 * 3 / 4) | %whx = $calc($1 / 2) | %why = $calc($1 * 3 / 8) }
;open the window and fill it with black
window -aBCdkop +d %a %wh | drawrect -rf %a 0 1 %wh
;create the hash table
if ($hget(star3d)) { hfree star3d } | hmake star3d %mxet
;set random position for all stars, and go !
var %i = 1 | while (%i <= %mxet) { d %i | inc %i } | .timerfps 0 1 o | c
}
;register fps
alias -l o { %ofps = %fps | %fps = 0 }
;rendom vars for star $1
alias -l d { b $+($1,x) $calc($rand(1,200) - 100) | b $+($1,y) $calc($rand(1,200) - 100) | b $+($1,z) $calc($rand(1,600) + 1) | b $+($1,v) $calc($rand(1,5) + 4) }
;render alias
alias -l c {
;somes stuff like vars and clear
if (%mxet < 0) %mxet = 0 | var %i = %mxet,%x2d,%y2d,%r | drawrect -rnf %a 0 1 %wh
;for each star
while %i {
;vars stuffs
if ($a(%i).z < -30) d %i
else hdec star3d $+(%i,z) $a(%i).v
;stars position in 2d plane
%x2d = $int($calc(256 * ($a(%i).x / ($a(%i).z + 40)) + %whx))
%y2d = $int($calc(256 * ($a(%i).y / ($a(%i).z + 40)) + %why))
;calc the color, $a(%i).z is between 0 and 600 so i divide it by 2.5 and reajust it before doing $rgb(%r,%r,%r) :P
%r = $calc(255 - (($a(%i).z - 100) / 2))
if (%r > 255) %r = 255
;if on screen draw stars ( niark a simple dot :P ) ( NOW WITH A COLOR, WHAOUUUUU :D )
if ($inrect(%x2d,%y2d,0,0,800,600)) { %m $rgb(%r,%r,%r) 1 %x2d %y2d }
;next stars
dec %i
}
;display anim infos ( stars and FPS )
%l 3 3 %mxet stars | if (%ofps) %l 3 13 %ofps FPS
;render screen, count fps and loop the alias
drawdot @star3d | inc %fps | .timerc -mh 0 1 c
}
;on close
on *:close:@star3d:{ .timerc off | .timerfps off }
;menu
menu @star3d {
Add 1 stars:inc %mxet 1
Add 5 stars:inc %mxet 5
Add 10 star:inc %mxet 10
-
Remove 10 stars:dec %mxet 10
Remove 5 stars:dec %mxet 5
Remove 1 star:dec %mxet 1
-
Close:{ close -@ @star3d | .timerc off | .timerfps off }
}
;#starfield3d - greetz to all