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.

DarkBASIC Discussion / Changing where I load files from?

Author
Message
Clbembry
19
Years of Service
User Offline
Joined: 10th Dec 2006
Location: Minnesota
Posted: 2nd Feb 2007 23:38
When I'm using Dark Basic and I want to load a file, it doesn't look in the place where I want it to. How do I change it so that when I say "load object" it loads an object from a folder that I want?
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 3rd Feb 2007 01:04
Set dir command.

Clbembry
19
Years of Service
User Offline
Joined: 10th Dec 2006
Location: Minnesota
Posted: 3rd Feb 2007 01:18
ok thanks
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 3rd Feb 2007 17:44 Edited at: 3rd Feb 2007 17:51
Set Dir will work fine, but you have to remember to set the directory back to the original directory if you have files to load from the startup directory.

A better idea is to not use Set Dir, but instead create a series of 'location' variables which are relative to the startup directory.

For example, in your program, you would have at the start:

Start$ = GET DIR$()+"\"

Then, if your data files were in the Data directory and Levels in the Levels directory you would use:

DataDir$ = Start$ + "Data\"
LevelsDir$ = Start$ + "Levels\"


...and so on for the required file locations.

The benefit of this is that in your program, when you want to load say a file called Level010.dat from the levels directory you simply use:

LevelsDir$+"Level010.dat"

...for the filename to load.

This method can also be used for loading and saving directories without having to switch directories all the time.

For your example, you would simply use:

ObjectsDir$ = Start$ + "Objects\" << or whatever folder you store them in.

Then use:

Load Object ObjectsDir$+"ObjectFilename.X", ObjectNum

TDK_Man

Login to post a reply

Server time is: 2026-07-06 10:34:33
Your offset time is: 2026-07-06 10:34:33