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 / Read/Write Float Trouble

Author
Message
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 26th Feb 2006 07:02
Hey,
I'm trying to write a float to a file and then read it (loading and saving), and it works fine if I save, create a new map, then open without closing the editor (its for a world editor), but for some reason if I exit the program then get back into it and try to load it, it won't read the variable it stored. Let me make sure I'm right, "write float 1,x" will write that variable to a file, correct? then "read float 1,x" will read the value of that variable in the file, right? So why won't it load it when I get back in? Is this a bug or am I doing something wrong? Heres my save map code

And heres my load code

Any help is appreciated, thanks.

Pirates of Port Royale:
http://www.popr.gwgaming.net (Temporarily Disabled, We Apologize for the Inconvenience)
Live the life.
driftman
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: Somewhere Outside of Sanity
Posted: 26th Feb 2006 10:31 Edited at: 26th Feb 2006 10:32
is it not getting decimal point, or not getting anything?
if it's not getting decimal points, try adding the # to the end of your variable name. could also be the use of the / as opposed to the , but don't quote me there. could also be that maybe you don't intialise your variable entered, or that it is = 1, and not > 1

I have a lil' white jacket that lets me hug myself forever.
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 26th Feb 2006 16:27 Edited at: 26th Feb 2006 16:47
Quote: "is it not getting decimal point, or not getting anything?"

no, the variable I'm trying to feed doesn't have a decimal point, and it reads it if I load it while not exiting out of the program, but if I get back into it, it doesnt.

that maybe you don't intialise your variable entered, or that it is = 1, and not > 1
No, i do that in the 'read input' gosub .

EDIT:
I even tried omitting the part where you type in what game to load and it loads a specific one, which should have "numberofcubes" equal to 20. I think the problem is in the "read float" command, am I using it right? The number is the file number, and the variable is the variable to load from that file?

Pirates of Port Royale:
http://www.popr.gwgaming.net (Temporarily Disabled, We Apologize for the Inconvenience)
Live the life.
driftman
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: Somewhere Outside of Sanity
Posted: 26th Feb 2006 22:00 Edited at: 26th Feb 2006 22:03
ok, you could try writing the number as a string to the file, then read it out, and convert to a value
something like
write:

read:


I have a lil' white jacket that lets me hug myself forever.

Login to post a reply

Server time is: 2024-09-24 17:28:27
Your offset time is: 2024-09-24 17:28:27