I have searched and read in the forum about this subject but am still confused as to just how it works. I've wrote a program I want to use as a screen saver. It will randomize for a while and then get stuck for a while and then go back to being random. I would appreciate all the help anyone would give. Here is the code:
randomize timer()
cls 0:hide mouse
sync on:sync rate 60
dim pos(80,2)
create bitmap 1,640,480
whole_screen=1:created_pic=2
get image whole_screen,0,0,639,480
get image created_pic,0,0,60,60
xypositions=1
for yposition=0 to 420 step 60
for xposition=20 to 560 step 60
pos(xypositions,1)=xposition:pos(xypositions,2)=yposition
inc xypositions
next xposition
next yposition
xypositions=rnd(79)+1:colorselect=1
grayincrement=5:redincrement=5:greenincrement=5:blueincrement=5
gosub make_flowers
cls 0:get image whole_screen,0,0,639,480
for yposition=0 to 420 step 60
for xposition=20 to 560 step 60
paste image created_pic,xposition,yposition
get image whole_screen,0,0,639,480
next xposition
next yposition
get image whole_screen,0,0,639,480
paste image whole_screen,0,0
sync
xyposition=rnd(79)+1:gosub random_color_pattern_selection
wait 2052
do
gosub place_boxes
loop
place_boxes:
for boxtime=1 to 601
if mousemovex()>1 or mousemovey()>1 then end
paste image whole_screen,0,0
paste image created_pic,pos(xyposition,1),pos(xyposition,2)
if patternselect=1 then gosub make_boxes
if patternselect=2 then gosub make_doodles
if patternselect=3 then gosub make_circles
if patternselect=4 then gosub make_flowers
if patternselect=5 then gosub make_letters
if patternselect=6 then gosub make_hlines
if patternselect=7 then gosub make_vlines
if patternselect=8 then mixitup=rnd(6)+1
if mixitup=1 then gosub make_boxes
if mixitup=2 then gosub make_doodles
if mixitup=3 then gosub make_circles
if mixitup=4 then gosub make_letters
if mixitup=5 then gosub make_hlines
if mixitup=6 then gosub make_vlines
if mixitup=7 then gosub make_flowers
if boxtime>300 and boxtime<600 then colorselect=rnd(10)+1
if boxtime=601
paste image whole_screen,0,0
for yposition=0 to 420 step 60
for xposition=20 to 560 step 60
paste image created_pic,xposition,yposition
wait 1
get image whole_screen,0,0,639,480
next xposition
next yposition
endif
xyposition=rnd(79)+1
get image whole_screen,0,0,639,480
sync
next boxtime
gosub random_color_pattern_selection
wait rnd(452)+552
return
make_boxes:
gosub set_bitmap_clearscreen
boxpositionx2=60:boxpositiony=0:boxpositiony2=60
for boxpositionx=0 to 30 step 3
gosub pick_color
box boxpositionx,boxpositiony,boxpositionx2,boxpositiony2
dec boxpositionx2,3:inc boxpositiony,3:dec boxpositiony2,3
next boxpositionx
gosub getpic_set_bitmap
return
make_doodles:
gosub set_bitmap_clearscreen
for doodletime=1 to 60
dx=rnd(60):dy=rnd(60)
gosub pick_color
dot rnd(60),rnd(60)
circle dx,dy,rnd(30)
line dx,dy,(dx+rnd(30))+10,(dy+rnd(30))+10
next doodletime
gosub getpic_set_bitmap
return
make_circles:
gosub set_bitmap_clearscreen
for circletime=1 to 60
gosub pick_color
circle 30,30,cr
inc cr
if cr>25 then cr=0
next circletime
gosub getpic_set_bitmap
return
make_letters:
gosub set_bitmap_clearscreen
set text font "arial"
set text size 60
set text to bold
data "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"
Ln=rnd(26)
for Lettertime=1 to Ln
read A$
next Lettertime
restore
gosub pick_color
center text 30,0,A$
gosub getpic_set_bitmap
return
make_hlines:
gosub set_bitmap_clearscreen
for hLine=0 to 60 step rnd(5)
gosub pick_color
line 0,hLine,60,hLine
next hLine
gosub getpic_set_bitmap
return
make_vlines:
gosub set_bitmap_clearscreen
for vLine=0 to 60 step rnd(5)
gosub pick_color
line vLine,0,vLine,60
next vLine
gosub getpic_set_bitmap
return
make_flowers:
gosub set_bitmap_clearscreen
for flowertime=1 to 10
rx=rnd(20)+20:ry=rnd(20)+20
gosub pick_color
circle rx,ry,5
circle rx,ry-6,5
circle rx,ry+6,5
circle rx-6,ry,5
circle rx+6,ry,5
for rn=1 to 5
circle rx+rn,ry+rn,5
circle rx-rn,ry-rn,5
circle rx+rn,ry-rn,5
circle rx-rn,ry+rn,5
next rn
next flowertime
gosub getpic_set_bitmap
return
set_bitmap_clearscreen:
set current bitmap 1
cls 0
return
pick_color:
if colorselect=1 then r=rnd(255):g=rnd(255):b=rnd(255)
if colorselect=2 then r=(rnd(200)+55):g=0:b=0
if colorselect=3 then r=0:g=(rnd(200)+55):b=0
if colorselect=4 then r=0:g=0:b=(rnd(200)+55)
if colorselect=5 then r=(rnd(200)+55):g=(rnd(200)+55):b=0
if colorselect=6 then r=(rnd(200)+55):g=0:b=(rnd(200)+55)
if colorselect=7 then r=0:g=(rnd(200)+55):b=(rnd(200)+55)
if colorselect=8
r=gray:g=gray:b=gray
inc gray,grayincrement
if gray>255 then grayincrement=-5
if gray<20 then grayincrement=5
endif
if colorselect=9
r=red:g=0:b=0
inc red,redincrement
if red>255 then redincrement=-5
if red<20 then redincrement=5
endif
if colorselect=10
r=0:g=green:b=0
inc green,greenincrement
if green>255 then greenincrement=-5
if green<20 then greenincrement=5
endif
if colorselect=11
r=0:g=0:b=blue
inc blue,blueincrement
if blue>255 then blueincrement=-5
if blue<20 then blueincrement=5
endif
ink rgb(r,g,b),0
return
getpic_set_bitmap:
get image created_pic,0,0,60,60
set current bitmap 0
return
random_color_pattern_selection:
patternselect=rnd(7)+1
colorselect=rnd(10)+1
return