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 in data from a file question (DBP)

Author
Message
Steve Fash
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 31st Oct 2004 00:07
I have a small .txt file containing a model name, texture name and x, y and z coordinates. I have been trying to use this to position a model on screen but for some reason keep getting file not found..The model, texture and setup file (as well as the code) are all in the same directory....Can anyone point me in the right direction as to what I'm doing wrong ?
Cheers


the setup.txt file is this :-

Thanks in advance
Steve


For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 31st Oct 2004 01:23
is setup.txt in the same dir with your exe? thats what your code is expecting.


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
Steve Fash
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 31st Oct 2004 01:54
Yes it is. I'm getting file does not exist at line 17 (which I presume is the model), but as I've said thats in there too

For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 31st Oct 2004 01:14
shouldnt the file contain

Cyborg.x or object1ob=Cyborg.x

instead of

object1ob="Cyborg.x"


I dont use the file operation is DBP I use my own so I am not sure if open to read etc uses a key=value pair or just reads the lines, but this is most likely the problem.

also, LOAD ARRAY reads data from a file into an arry, as the data is listed in the file, automatically separating on line breaks so you could make your file:

Cyborg.x
cyborg.dds
0
-6
40

and read it into a string array:

Dim myArray() as string
Load array("setup.txt",myarray())


DBP_NETLIB_v1.4.3 DarkTOPIA site coming soon!
Steve Fash
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 31st Oct 2004 01:49
hmmm, still no joy
Can anyone else shed some light on my problem ?

For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
Steve Fash
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 31st Oct 2004 01:53
Heres a zip contatining the files if some1 could take a look ?
Cheers

For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk

Attachments

Login to view attachments
Steve Fash
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 31st Oct 2004 16:01
Anyone ?

For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 31st Oct 2004 16:57 Edited at: 31st Oct 2004 17:13
Code should be something like this

And change the setup file to something like this and you won't have to parse out all of the unwantend info thats in your version.


I changed the model extension to .x as there was no .dbo.
Also notice I used read string for all of the info. Thats because all of the info in that file is in string form. You can't use read byte on a string. If you write a byte with the value of 40 to a file it looks like ( instead of 40. Using strings makes it easier for a person to read but more work for a computer to read it. It all depends on how you want to write the data to the file.

Steve Fash
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 31st Oct 2004 17:27
Oh yeah, forgot I'd changed it to dbo in the other folder, DOH!
Thanks for your help mate, works fine now

For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 31st Oct 2004 17:33
Glad its working. CR has some great file functions in his DBP_NetLIB plugin you may want to try out. Any computer you run the application on will have to have .net framework installed on it though.

Steve Fash
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 31st Oct 2004 17:35
only thing is now as I increase the zdepth and bring the model forward it's not a float so in comes forward too quick......

For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
Steve Fash
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 31st Oct 2004 17:42
ahh, sorted it...made object1z2 a float and copied into it object1z...
Works a treat...
thanks again

For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
computer
19
Years of Service
User Offline
Joined: 5th Oct 2004
Location:
Posted: 25th Nov 2004 05:26
I just used this post for the

read string 1,test$
object1x = val(test$)

as I couldn't change strings to numbers.

bleep bleep

Login to post a reply

Server time is: 2024-09-23 05:21:48
Your offset time is: 2024-09-23 05:21:48