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 / File related question

Author
Message
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 6th Jun 2003 19:27
Hello,

I'm writing a program in witch I see my level for my FPS and just by postitioning a cone and then click store coördinates for my enemy's/other objects. It also store the number of the enemy and what kind of enemy it is. I'm pretty far, the only thing is that it doesn't want to store the correct numbers. When I read the file I stored, it gives the wrong answors. I'm sure that it is just a little mistake like I make all the time, but I can't figure out what it is.

Here's the code:



Oh yes, before I forgot, I use Magic World to make my levels, but with a simple adjustmend you can use it to
If good programmer()=1 then print "Finaly I get to the top "
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 7th Jun 2003 00:30
read file 2,xposa#:write file 1,xposa#
read file 2,placez#:write file 1,placez#

shouldn 't it be :

read file 2,placex#:write file 1,placex#
read file 2,placez#:write file 1,placez#
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 7th Jun 2003 20:08 Edited at: 7th Jun 2003 20:14
Hey that's right

But that isn't the real problem, I think



In this pease of code there is one of the problems. He writes the monster and enemynumber, but the coördinates are always 0 But why?



There also must be an error in this code. It is supposed to copy the old files into a new file, but it only copy's the first, second and the last coördinates. All other numbers are displayed as -1003456 or something

Any help is welcome!

If good programmer()=1 then print "Finaly I get to the top "
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 7th Jun 2003 21:57
placex# and placez# are floats..i guess you must use
write float filenumber,variable
because:
WRITE FILE
This command will write a long word of data to the file from an integer value. This
is the standard command for writing data where the datatype is not important.
The file specified by the file number must be open or the command will fail.
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 8th Jun 2003 20:43
Tnxs,

I found a sollution. I save each coördinate in a diffrend file now. It works well, so you may use it if you wan't

If good programmer()=1 then print "Finaly I get to the top "
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 8th Jun 2003 22:24
thanks..i don't need it..i save my stuff as a single file in a multi dimensional array and read from it too

Login to post a reply

Server time is: 2024-09-20 10:29:33
Your offset time is: 2024-09-20 10:29:33