|
Post by sbdjazz on Feb 13, 2017 9:06:30 GMT
The title says it all. How do I do it? I want to save some variable values in a save game file and then access them from other levels in the same game.
|
|
|
Post by WhyNot on Feb 13, 2017 10:04:31 GMT
there is a project called File "iFileStringReadWriteTest.3dr" in script usage and examples in your 3d rad directory This wored out for me...
|
|
|
Post by sbdjazz on Feb 13, 2017 11:07:47 GMT
Thanks man!
|
|
|
Post by TinSoldier on Feb 13, 2017 23:27:00 GMT
Well that is an option YRN, there are 2 things to consider before deciding which method is best !
To share data between levels in the same project AND using saved data at some later time, then yes file saving is the way to go,
IF you only need to share data between levels in the same project, but NOT at some later date, the better idea is to use global strings.
iGlobalStringSet(string,int); Set the specified element of the global array of strings. The global array of strings can hold up to 1024 strings and is accessible by all scripts in the project or all scripts in all projects that have been compiled together (e.g. a multi-level game). string = string to copy to the specified array element (1024 characters max). int = array element index (0-1023).
As mentioned, the global strings are accessible by all scripts and all levels compiled together into one project, no file reading or writing required. And you could add file reading & writing if you did want to save for a later date, or possibly adding a save game option.
|
|
|
Post by WhyNot on Feb 14, 2017 2:21:46 GMT
I never thought of that... Thanks bro!
|
|
|
Post by sbdjazz on Feb 14, 2017 17:30:54 GMT
Thanks, I want to access the data the at a later time and every time the game starts. And thanks for the global strings. That would be useful too.
|
|