Execute this piece of code and check it.
`Creating a lot of lights and turnig on and off to have up to eight lights shining in the scene
`Chafari 25-9-2009
autocam off
sync on
`Texture for floor
ink rgb(100,110,90),1
box 0,0,100,100
ink rgb(90,120,80),1
box 10,10,90,90
get image 1,0,0,100,100,1
set ambient light 40
hide light 0
for i= 2 to 30
make object box i,5,5,5
position object i,30,2,0+i*100
next i
for i= 2 to 30
make object box 30+ i,5,5,5
position object 30+ i,170,2,0+i*100
next i
`we create 30 lights but just eight of them will shine at once and we turn off the rest
for i= 1 to 30
make light i
position light i,100,10,50+i*100
color light i,rgb(rnd(255),rnd(255),rnd(255))
set spot light i,45,80
next i
make object box 1,5,50,5:set object light 1,2
make matrix 1,200,3000,100,300
prepare matrix texture 1,1,1,1
position camera -100,700,-300
point camera -50,100,500
z=0
do
r#=wrapvalue(r#+0.3)
for i= 1 to 30
position light i,100,20,50+i*100:set light range i,2500
color light i,rgb(rnd(255),rnd(255),rnd(255))
rotate light i,25,r#,0
next i
ink rgb(255,255,255),1
set cursor 5,5:print "UP TO EIGHT LIGHTS AT A TIME IN SCENE "
set cursor 5,440:print "USE UPKEY-DOWNKEY "
if upkey()=1 then z=z+10
if downkey()=1 then z=z-10
if z<0 then z=0
if z>2800 then z=2800
position object 1,100,25,z
for i= 1 to 30
lp=light position z(i)
if z>lp-500 and z<lp+500 then show light i else hide light i
if light visible(i)>0 then set cursor 5,15+12*i:ink rgb(255,255,0),1:print "Light ",i," ON"
if light visible(i)=0 then set cursor 5,15+12*i:ink rgb(80,80,80),1:print "Light ",i," OFF"
next i
sync
loop
I'm not a grumpy grandpa
