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 / Loading and Including code from external file!!

Author
Message
SlayrUK
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location:
Posted: 26th May 2005 23:29
Hi,

I just finished making my level editor so that my game is now so much easier to make! However, I've run into some difficulties.

All code from the level maker is stored as a file in the same directory. When I put all the code into a function makelevel() and run that from my game it works fine - however when making it so you have to input the name of the file to include, the editor wouldn accept it - presumably because it could not find the makelevel() function. The code is below. Anyone know how I can solve this, or any other ways to include external code?
Thanks



NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 27th May 2005 11:44
SlayrUK,

I could be wrong, but I believe that in DarkBasic, one can only use the #INCLUDE command to include .DBA files. This may be your problem.


+NanoBrain+
SlayrUK
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location:
Posted: 27th May 2005 19:50
I think thats wrong, because when I specify the file name, it includes it fine.

Its just getting it to include a variable file name filename$ and accept the function from it... it just wont.

Any more ideas?

Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 28th May 2005 08:19
#include is a precompiler function. You cannot conditionaly include a file because it gets done on compile, not run.


"Lets migrate like bricks" - Me
SlayrUK
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location:
Posted: 28th May 2005 09:18
oh ok, thanks.

Any ideas what I could do to include different levels then??

waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 28th May 2005 09:27
yes, its simple, but complicated ....


support magik world.
Or, examine to Load_Level function that it generates,
and make your own level in that manner.

Simple because:
MW will load the level for you
All you need do is pass the filename for your level.

Complicated Because:
MW is too versitile. You'll need to create your own docs
as to what features not to use. You'll need to modify the
loadlevel function to prevent accidental use of those features.
You'll need to write your own procedure for removing all media
from your game to enable the use of multiple levels.
Guitarman
21
Years of Service
User Offline
Joined: 31st Jan 2004
Location:
Posted: 28th May 2005 12:12
what about using arrays to store the object info in the level editor, then loading the array and virtually recreating the level in the actual game? I know it's inconvinent, but it's the only way I can see...

Login to post a reply

Server time is: 2025-05-22 23:37:17
Your offset time is: 2025-05-22 23:37:17