This function is best used when exiting your program and
will clean it all up neatly for you.
rem -------------------------------------------------------------------
rem name : DarkBasic Professional Ultimate Cleanup Function
rem date : 15th december 2003
rem author : indi ( david smith )
rem email : indi_frost@yahoo.com.au
rem
rem usage : This function will help you delete all the media
rem : of your program in one fould swoop.
rem : If you supply a media location with a zero
rem : It will skip that media component.
rem : If you know your maximum amount of objects in that,
rem : media location then feed the function an exact amount.
rem : The function will handle a number higher than the media
rem : expected to be deleted but may slow the function down
rem : somewhat if given too high a number.
rem
rem example : CleanUp(100,3,15,1,45,2,5,8,1,0,0,0)
rem : this program doesnt have any memblocks or dlls or particles
rem -------------------------------------------------------------------
function CleanUp(MaxObjs,MaxMtx,MaxSnd,MaxMsc,MaxImg,MaxBmp,MaxSpr,MaxLts,MaxCam,MaxMemBlk,MaxDll,MaxPtcl)
if MaxObjs > 0
for i = 1 to MaxObjs
if Object exist(i)
delete object i
endif
next i
endif
if MaxMtx > 0
for i = 1 to MaxMtx
if Matrix exist(i)
delete Matrix i
endif
next i
endif
if MaxSnd > 0
for i = 1 to MaxSnd
if Sound exist(i)
delete Sound i
endif
next i
endif
if MaxMsc > 0
for i = 1 to MaxMsc
if Music exist(i)
delete Music i
endif
next i
endif
if MaxImg > 0
for i = 1 to MaxImg
if image exist(i)
delete image i
endif
next i
endif
if MaxBmp > 0
for i = 1 to MaxBmp
if Bitmap exist(i)
delete Bitmap i
endif
next i
endif
if MaxSpr > 0
for i = 1 to MaxSpr
if Sprite exist(i)
delete Sprite i
endif
next i
endif
if MaxLts > 0
if MaxLts > 8 then MaxLts = 8 : rem prevent maxlights overflow
for i = 1 to MaxLts
if Light exist(i)
delete Light i
endif
next i
endif
if MaxCam > 0
for i = 1 to MaxCam
delete Camera i : rem camera command required if camera exist()
endif
next i
endif
if MaxMemBlk > 0
for i = 1 to MaxMemBlk
if MemBlock exist(i)
delete MemBlock i
endif
next i
endif
if MaxDll > 0
for i = 1 to MaxDll
if Dll exist(i)
delete Dll i
endif
next i
endif
if MaxPtcl > 0
for i = 1 to MaxPtcl
if Particles exist(i)
delete Particles i
endif
next i
endif
endfunction