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.

DarkBASIC Discussion / Variables get changed?

Author
Message
D a r k
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: In ur fridge, eatin ur foodz.
Posted: 7th Dec 2004 11:31
Ok im working on my text based rpg and im attempting to save the user's stats in a file, I can create the file and save the variables to it, but when I load the file again the variables are all messed up. Can someone help me with this?

Here is my Writing file and Reading File code:

If I do not exit the editor the variables will be what i want them to be, if I do exit the editor and come back in the variables will be different then the ones I set.

(Example, Without closing the game when it prints "Stength" it says
Strength 1, then if a close it and load it again it says Strength
-16078789 or 0
BadMonkey91
21
Years of Service
User Offline
Joined: 13th Jan 2004
Location:
Posted: 7th Dec 2004 11:59 Edited at: 7th Dec 2004 12:07
This code works for saving variables


If you are having problems with variables, sometimes you just need to add a # sign. This makes the value real.

Strength# <--- Example of how to use pound sign

D a r k
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: In ur fridge, eatin ur foodz.
Posted: 7th Dec 2004 12:32
ok I did the pound key thing but again it works once then when i quit and start again it changes it to a zero automatically. Can anyone tell me why it does this, explain to me how to read a variable from a file and store it as a variable in the program.

Login to post a reply

Server time is: 2025-05-24 07:43:40
Your offset time is: 2025-05-24 07:43:40