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.

Newcomers DBPro Corner / Reading more that 32 files or loading multiple files one at a time under the same file number

Author
Message
Chibi Babble
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location:
Posted: 13th Jul 2008 06:12
I'm trying to figure out how to load more than 32 files

Here's my code



I only need to do this one at a time. I thought that is you closed the file it was gone for good, like deleting an object and then loading an object as that same number, however this isn't the case. Is there anyway around this? Thanks

Chibi?
SirFire
19
Years of Service
User Offline
Joined: 4th Apr 2005
Location: North America
Posted: 13th Jul 2008 08:56 Edited at: 13th Jul 2008 11:29
Make sure you close the previous file before opening a new one, as DBP only allows 32 files to be open at once. You might be increasing the level number before the file open check, which will always tell you it's closed, since it's moved on to the next file already.

This is a bit of code that will load all your levels at one time and store them in an array:



The example assumes that all your level files all are numbered starting with 0.txt

_____________________
Windows Vista: Just say no.
Chibi Babble
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location:
Posted: 13th Jul 2008 19:07 Edited at: 13th Jul 2008 19:09
Maybe I wasn't clear.

I guess what I should ask is how do you make sure darkbasic reads the very first line of every file. I'd rather do it this way:



So that way the "file number" is always 1, but the "file number" 1 is able to clear its memory on what it originally loaded, and load a completely different file.

Chibi?
Chibi Babble
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location:
Posted: 13th Jul 2008 19:24
oh wow don't I feel silly.

I was forgetting to change one thing in my code that actually read the file and now everything works

woops

Chibi?

Login to post a reply

Server time is: 2024-09-27 18:26:45
Your offset time is: 2024-09-27 18:26:45