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 / Saving and loading values

Author
Message
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 10th Jul 2003 19:37
i dont have a problem with saving, but how can i load these same values so next time when the user openes the program he'll find his same values that were saved last time.
i'm using these methods on a Settings menu which consist of radio buttons for resolution, display mode, texture and sound. i gave every set a value, e.g resolution 640x480 = 0 ,resolution 800x600 = 1 etc.
i just need the info on how to load these same values to the user.
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 10th Jul 2003 19:40
forgot to give ya the code i'm using :
for loading:
open to read 1,"settings.cfg"
read string 1,a$ : resolution=val(a$)
read string 1,a$ : display=val(a$)
read string 1,a$ : texture=val(a$)
read string 1,a$ : sound=val(a$)
close file 1

for saving:
open to write 1,"settings.cfg"
a$=str$(resolution) : write string 1,a$
a$=str$(display) : write string 1,a$
a$=str$(texture) : write string 1,a$
a$=str$(sound) : write string 1,a$
close file 1
i just want to know how i can load the radio buttons in the same position.
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 11th Jul 2003 21:12
can anyone help me out? any clues? suggestion?
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 12th Jul 2003 17:43
anybody????????????????????????????????????????????????????????
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 12th Jul 2003 19:15
You didn't really explain your problem, you just said your code wasn't working. It looks fine to me, apart from you should have a line checking if the file exists, so that you can delete it and save it, or else db will come up with an error message saying the file exists. You should also check if it exists before the loading, or else you will be trying to load a non existant file.

Here is a small demo on how to use these commands (source box)...

cuRant PRogekt: a three-de map editer
Why the hell'd you ask me for crying out loud!?!
Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 12th Jul 2003 22:10
ok, now ur code really helped me out. now i want ya to look at the label "printit:", u have inputs, i have OBJECTS. now my problem is how can i load those objects into their same position as i saved them?
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 12th Jul 2003 22:13
ok, now ur code really helped me out. now i want ya to look at the label "printit:", u have inputs, i have OBJECTS. now my problem is how can i load these objects into the settings menu as i saved them. i just want to load them into their same position when i close and open my program again.

Login to post a reply

Server time is: 2025-05-19 19:28:59
Your offset time is: 2025-05-19 19:28:59