I am nearly done with a new game that I am making using that cool .exe feature of 3dfa. I can not find anyway to allow my users to save there game. I have about 15 varables that need to be saved in order for the game to be saved. I don't know a way to do this on a .exe file running on someones computer since there is no database. I would like this to be saved to some type of txt file. Any help would be appreciated.
I am totally lost on this idea.
Thank you so much for your help. This makes my job easy. this is one of the coolest features that is undocumented. I have been trying stuff the hard way for a long time.
This is an undocumented feature, but certainly something worth mentioning in the help file ...
string = "my string"
string.save ("filename")
string.load ("filename")
Uh...wha....o.O.....is this new? Because this is INSANELY AWESOME USEFUL CRAZY!!!
Anywho, on to your question. To load the varibles just do...
myvar.load ("filename")
myvar will now be equal to whatever the text was in the file.
To save multiple files just change the names.
myvar1="hello"
myvar2="bye"
myvar1.save ("save1")
myvar2.save ("save2")
You could also combine the strings then save the variables and when you load it just seperate each varible with some string functions. If you would like to see an example of that I can make one.
There will also be a function called fileLoad("filename"). You will love this function. It will allow you to save and load objects and arrays to the local drive.
The object MUST use the .object extension otherwise fileLoad won't know what type of data to expect. Likewise, arrays must be saved using the .array extension.
array1 = new Array (131, 174);
array1.save ("myArray.array");
The array can be a multidimensional array containing objects. Likewise, an object can contain arrays, and this kind of data tree can traverse to any depth.
These features already exist but were not made publicly available because they cannot be used in Flash animations. However, .exe projects should be allowed to do anything.
Another useful undocumented feature is using 'debug' instead of 'trace'. Debug does not require brackets.
trace (any_kind_of_expression) is the same as
debug any_kind_of_expression
You could also combine the strings then save the variables and when you load it just seperate each varible with some string functions. If you would like to see an example of that I can make one.