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 / Help with Saving Positions To File

Author
Message
Specters
18
Years of Service
User Offline
Joined: 30th Sep 2005
Location: idaho
Posted: 7th Nov 2005 17:04
Okay,

I am trying to create a save file that's hold your positions once you save. Since it is a FPS, I use 1pX# and 1pZ# to show your position.

Print 1pX#
Print 1pZ#

That's what would show your position.

Now since when you write something to a file, it must be a string.

How would I write 1pZ# as a string?

This has been confusing me for a while.
HELP!

new site : sealgames.tk
Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 7th Nov 2005 19:24
Use the STR$ command to convert a value into a string.

So the code would look like:



Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 7th Nov 2005 20:39
Quote: "Now since when you write something to a file, it must be a string. "


You don't have to write just a string to a file.

Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 7th Nov 2005 21:33
Oh, I misread the post I thought he wanted the value written as a string

Specters
18
Years of Service
User Offline
Joined: 30th Sep 2005
Location: idaho
Posted: 7th Nov 2005 22:20
Thanks, now I understand.

Grog, you are always helping me.

new site : sealgames.tk
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 7th Nov 2005 22:48
Quote: "Oh, I misread the post "


Don't feel bad... that happened to me too a few days ago (and it lasted 2 days).



Quote: "Grog, you are always helping me."


Np. I'm glad I can help.
Specters
18
Years of Service
User Offline
Joined: 30th Sep 2005
Location: idaho
Posted: 7th Nov 2005 22:54
Seriously, I didn't know to change it to Write float
I had it write sting

new site : sealgames.tk
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 8th Nov 2005 13:33 Edited at: 8th Nov 2005 13:33
Personally, I would consider writing all data as strings anyway.

It's not any better than writing any of the other data types, but the major advantage when writing data to files as strings is the ability to open the file with notepad and examine the data you have written.

If you are writing a fair amount of data, at first you can add message comments to the file to make checking what has been written to what should have been written a lot easier. You can always remove them later.

TDK_Man

Specters
18
Years of Service
User Offline
Joined: 30th Sep 2005
Location: idaho
Posted: 8th Nov 2005 20:25
Oh crap, I tried so save as a float, then a string, and it still isn't positioning the camera where I saved it as. Can someone help with this.

Drew G

new site : sealgames.tk
Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 8th Nov 2005 20:45 Edited at: 8th Nov 2005 20:55
If you show the code you're using, then it would be a lot easier to help


EDIT:

Here's the basic code used for storing of a string in a file, and then opening and reading the contents:




Just ask if there's anything you don't understand



EDIT 2:

Here's a basic code that converts a value to a string, writes it to a file. Then open the file again, read the string, and convert back to a value. Just ask.




Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Nov 2005 08:15 Edited at: 9th Nov 2005 08:16
Quote: "Oh crap, I tried so save as a float, then a string, and it still isn't positioning the camera where I saved it as. Can someone help with this."


You could always put the data in an array and use the "save array" and "load array" commands. It'll save you the headaches of making file reading and writing routines. I don't know if that will solve your problem though (without seeing your code).
Plugged
21
Years of Service
User Offline
Joined: 30th Nov 2002
Location: Hertfordshire
Posted: 9th Nov 2005 11:47
grog you love the load save array commands don't you

cheers
Plugged


Work Hard; Play Harder ;
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Nov 2005 19:29
Quote: "grog you love the load save array commands don't you"


I love any command that gives me more programming options. I especially love them when it only takes one line vs several lines to do the same thing.

Login to post a reply

Server time is: 2024-09-24 07:23:00
Your offset time is: 2024-09-24 07:23:00