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 / File loading - made easy

Author
Message
MaNaR
19
Years of Service
User Offline
Joined: 9th Oct 2005
Location: Netherlands
Posted: 10th Oct 2005 23:47
I got very tired of messing with the file numbers whenever loading a texture or a model so I wrote a very simple function that makes life a lot easier! The main advantages are that you don't have to worry about entering duplicate object numbers, the loader routine solves this! And refering to file numbers is history because now you can refer to file/object names.

The standard Darkbasic routines look like this :
Load object "model.x",1
Position object 1,0,0,0
Whenever you want to address this model you will have to remember it's number. Check below how to get round this problem

My routine looks like this :
obj_EnemySpinner = LoadFile("models/enemies/enemy-spinner.x",1)
Position object obj_EnemySpinner,0,0,0

The line reads :
VariableName = LoadFile("filename",filetype) (1=model,2=texture)

If you have questions, mail me or reply to this post!
MaNaR
19
Years of Service
User Offline
Joined: 9th Oct 2005
Location: Netherlands
Posted: 11th Oct 2005 09:47
Hmm, the included snippet has disappeared.
And I can't edit my post to add it again

Here is a link where you can find the code as well.

http://www.zieners-hosting.nl/hailstone/kaisertal/index.php?item=downloads
Vues3d on Kalimee
20
Years of Service
User Offline
Joined: 12th May 2004
Location: NYON (SWITZERLAND)
Posted: 11th Oct 2005 09:53
Seems that the server doesn't let retrieve the file...

MaNaR
19
Years of Service
User Offline
Joined: 9th Oct 2005
Location: Netherlands
Posted: 13th Oct 2005 20:39
yes, the source link doesn't work.. no idea why, and i'm not allowed to edit this post.

try the link in the post above
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 14th Oct 2005 02:18



There ya go.
Kohaku
20
Years of Service
User Offline
Joined: 3rd May 2004
Location: The not very United Kingdom
Posted: 14th Oct 2005 02:45
I use these functions myself.



so



You are not alone.
MaNaR
19
Years of Service
User Offline
Joined: 9th Oct 2005
Location: Netherlands
Posted: 23rd Oct 2005 00:36
Thanks Xenocythe!
JulesD
19
Years of Service
User Offline
Joined: 7th Feb 2005
Location:
Posted: 23rd Oct 2005 17:38
I added an fx loading.
MaNaR
19
Years of Service
User Offline
Joined: 9th Oct 2005
Location: Netherlands
Posted: 23rd Oct 2005 21:01
Nice one JulesD,

We could add sound and music as well
JulesD
19
Years of Service
User Offline
Joined: 7th Feb 2005
Location:
Posted: 24th Oct 2005 10:34
In the above source it Change "fx_glow".....
should be Change "glow"....

Little Mistake.

Login to post a reply

Server time is: 2024-11-23 11:22:05
Your offset time is: 2024-11-23 11:22:05