Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / A Delete Function

Author
Message
Sneaker
19
Years of Service
User Offline
Joined: 11th Apr 2005
Location:
Posted: 20th Oct 2006 11:49
rem you send: Delete("te.x sprite,image etc","start number",
rem "end number")
rem Te.x Delete("sprite",1,5) will delete sprite 1-5
rem

function Delete(sak$,from,till)

for i=from to till

if sak$="sprite" and sprite exist(i) then delete sprite i
if sak$="image" and image exist(i) then delete image i
if sak$="animation" and animation exist(i) then delete animation i
if sak$="sound" and sound exist(i) then delete sound i
if sak$="music" and music exist(i) then delete music i
if sak$="bitmap" and bitmap exist(i) then delete bitmap i

next i

endfunction
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 20th Oct 2006 18:25
Not bad but very innefficient. You should perform the string check once outside of the for/next loop otherwise you are carrying out lots of unnecessary processes.

Login to post a reply

Server time is: 2024-11-22 23:13:37
Your offset time is: 2024-11-22 23:13:37