Posted: 15th Dec 2003 2:21
This function is best used when exiting your program and
will clean it all up neatly for you.

+ Code Snippet
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

Posted: 15th Dec 2003 6:07
Awesome... Yes, this would save alot of time...
Posted: 15th Dec 2003 11:21
Ummm - the maximum number of objects is something around $37FFFFF (dont have my notes so I dont have the exact figure). However, it is somewhat over the 3 million mark.
Posted: 15th Dec 2003 15:39
Then I guess someone could add to the function for another object delete section if they had to

Nice Indi - I always do this,,,,only without a function

RPGamer
Posted: 19th Dec 2003 10:22
I thought the maximum number of objects was 65k something.
Posted: 20th Dec 2003 4:07
the maximum number of objects is 65,535. Unless some patch raised that number without warning...
Posted: 21st Dec 2003 11:19
that limit is only correct using classic DB and not Pro.

If santa wasnt coming I would say something naughty
Posted: 21st Dec 2003 12:00
Indeed - its around 3 million or so (could be more with objects as, with sprites, some of the ranges are used internally).