How to compile a screensaver *.scr

BlitzPlus Forums/BlitzPlus Programming/How to compile a screensaver *.scr

I have made a little screensaver for you all to play with.
It does not appear in the mini-window but does respond to the "Preview" button.
The "Settings" button does nothing.
When you have compiled it, rename the .exe to .scr and copy it to the Windows directory.
It should then be immediately available to the "Display Properties -> Screen Saver".
;===============
;   Seti-Bot
;  julianbury
;  2003.08.01
;===============

AppTitle "Seti-bot"
ChangeDir SystemProperty$("appdir")
If CommandLine$() = "/S" Or CommandLine$() = "/s" Then goto startup
End

.startup

Global sincos=9999
Global vertices	= 6000
Global distortion = 1800
Global xaxis, yaxis, zaxis
Global posx, posy, posz
Global xres, yres, xh, yh, yb, yc, xi,yi,di, xm,ym,nn,nnn

Dim icos(sincos+1)
Dim isin(sincos+1)
Dim drawx(vertices)
Dim drawy(vertices)
Dim drawd(vertices)
dim vis(vertices)
Dim drawc(vertices)
Dim viewx(vertices)
Dim viewy(vertices)
Dim viewz(vertices)
Dim worldx(vertices)
Dim worldy(vertices)
Dim worldz(vertices)
dim r(64),g(64),b(64)
dim xc(64), tc(64)
dim xk(64), yk(64), tk(64)
dim xb(8), bar(8)

xres = GadgetWidth(Desktop())
yres = GadgetHeight(Desktop())
xh=xres/2
yh=yres/2

Graphics xres,yres
SetBuffer BackBuffer()
SeedRnd Millisecs()

posx	= 0
posy	= 0
posz	= 0
xaxis	= 0
yaxis	= 0
zaxis	= 0
sincos_tables()

Origin xh, yh
For n=0 To vertices-1
	worldx(n)=Rand(0,2550000)-1270000
	worldy(n)=Rand(0,2550000)-1270000
	worldz(n)=Rand(0,2550000)
Next
for n=0 to 7
	xb(n)=xh-(32+n*6)
	bar(8)=rnd(80)
next
yb=yh-32
for n=0 to 63
	r(n)=rand(1,2)*127
	g(n)=rand(1,2)*127
	b(n)=rand(1,2)*127
	xc(n)=n*4-128
	tc(n)=0
	tk(n)=0
	xk(n)=32+(8*(n mod 4))-xh
	yk(n)=yh-(48+(32*(n/16))+(8*(n/4)))
Next
yc=yh-48


While Not KeyDown(1)
	For n=0 To vertices-1
		worldz(n)=worldz(n)-3000
		If 	worldz(n)<1 Then
			worldx(n)=Rand(0,2550000)-1270000
			worldy(n)=Rand(0,2550000)-1270000
			worldz(n)=2550000
		EndIf
	Next
	rotate_about_object
	drawstars
	if MouseX() <> 0 Or MouseY() <> 0 Or GetKey() <> 0 Or GetMouse() <> 0 then end
Wend


Function sincos_tables()
	s#=360.0/(sincos+1)
	a#=0
	For n=0 To sincos
		isin(n) = (Sin(a#)*4096.0)
		icos(n) = (Cos(a#)*4096.0)
		a#=a#+s#
	Next
End Function


Function rotate_about_object()
	di=0
	nn=0
	For n=0 To vertices-1
		vis(n)=0
		xx# = worldx(n)
		yy# = worldy(n)
		zz# = worldz(n)
		y# = (yy# * icos(xaxis)) - (zz# * isin(xaxis))
		z# = (yy# * isin(xaxis)) + (zz# * icos(xaxis))
		yy#=(y#/4096): zz#=(z#/4096)
		x# = (xx# * icos(yaxis)) + (zz# * isin(yaxis))
		z# = (zz# * icos(yaxis)) - (xx# * isin(yaxis))
		xx#=(x#/4096): zz#=(z#/4096)
		x# = (xx# * icos(zaxis)) - (yy# * isin(zaxis))
		y# = (xx# * isin(zaxis)) + (yy# * icos(zaxis))
		xx#=(x#/4096): yy#=(y#/4096)
		viewx(n) = xx# - posx
		viewy(n) = yy# - posy
		viewz(n) = zz# + posz
		If viewz(n)>0 Then
			drawx(n) = (viewx(n)*distortion)/viewz(n)
			drawy(n) = (viewy(n)*distortion)/viewz(n)
			drawd(n) = 1+((1000*distortion)/viewz(n))
			if drawx(n)>-xh and drawx(n)<xh and drawy(n)>-yh and drawy(n)<yh
				vis(n)=1
				if abs(drawx(n))<200 and abs(drawy(n))<200 then di=drawd(n):nn=n
			endif
		EndIf
	Next
	xi=drawx(nn)
	yi=drawy(nn)
	xm=xi+di/2
	ym=yi+di/2
	if nnn<>nn
		for n=0 to 63:tc(n)=0:next
		for n=0 to 7:bar(n)=1:next
		nnn=nn
	endif
End Function


Function drawstars()
	Cls
	Color 255,255,255
	For n=0 To vertices-1
		if vis(n)=1 then Rect drawx(n), drawy(n),drawd(n),drawd(n)
	Next
	Color 0,255,0
	line xm,ym+8,xm-4,ym+32
	line xm,ym+8,xm+4,ym+32
	line xm,ym-8,xm-4,ym-32
	line xm,ym-8,xm+4,ym-32
	line xm+8,ym,xm+32,ym-4
	line xm+8,ym,xm+32,ym+4
	line xm-8,ym,xm-32,ym-4
	line xm-8,ym,xm-32,ym+4
	for n=0 to 63
		rr=rnd(64)
		if rr<n
		  rr=rnd(40)
			if rr=3 then tc(n)=rnd(0,1)
		endif
	Next
	Color 255,0,0
	for n=0 to 63
		if tc(n)=1 then rect xc(n),yc,3,16
	next
	if rnd(12)=7
		n=rnd(0,63)
		r(n)=rnd(0,1)*255
		g(n)=rnd(0,1)*255
		b(n)=rnd(0,1)*255
	endif
	for n=0 to 63
		rr=rnd(32)
		if rr=1 then tk(n)=rnd(0,1)
		if tk(n)=1 then Color r(n),g(n),b(n):rect xk(n),yk(n),6,6
	next
	for n=0 to 7
		bar(n)=bar(n)+rnd(0,16)-8
		if bar(n)<1 then bar(n)=1
		Color r(n),g(n),b(n):rect xb(n),yb-bar(n),4,bar(n)
	next
	Flip
End Function


Well there it is :-)