2019-01-04 06:03:00 (edited by Zarvox 2019-01-04 06:04:18)

Hi, I have a simple request I told bgt to do. There  are 4 menus that will be presented when opening my app, if the user presses m, they can select which one is active when it opens. However, the setting is only saved until the program exists. Can I save this variable without having to serialize a file? The save function only has the line sd.set("launch",launch); and the load function has the if.sd.exists line and the sd.get line. So should I add a line in the save function to change it internally without needing an external file?

2019-01-04 07:45:35

All you need do is save this in a global variable. If you want to save this when the program is not loaded, you will need to use a file. There is no other way.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-01-04 15:21:37

Well, although technically stored in a file, you can also use the registry

Roel
golfing in the kitchen

2019-01-05 12:59:06

Keep in mind that in a program, a variable only exists until the program closes. To save variables between runtimes you need to either save it to the registry or save it in a file. I highly highly recommend learning serialize and deserialize as they will save you countless hours of frustration when you attempt to write your own settings class. Back before BGT has serialize and deserialize I made my own settings writer and reader. Ugh.

Much less active on this forum than in the past.

Check out my live streams: http://lerven.me
follow me on Twitter: http://twitter.com/liamerven