Save File location controlled by game_variable

Started by Memor-X, June 15, 2011, 11:40:38 pm

Previous topic - Next topic

Memor-X

as of late i've been doing work on Pandora, at the moment i'm trying to get the backup data function working but i found out that i didn't have anything to control save files from games, so i went back into my Pandora Achievement Script in RMXP and found that it didn't put save games into the profile's save folder, it only updated the Achievement .dix file in Pandora

i've been missing around trying to get the the folder location that i got stored in $game_variable[2] to be added to Scene_File, i added "$game_variable[2] +" before the string in the make_filename function in Scene_file but it doesn't seem to work, i'm getting data into the variable is when the game boots up it imports data from an external plain text file, the data imported is "C:/Pandora Test/Save/", i have a New Game Plus script that is saving the data of the variable between games, when i use show message for the variable it shows that but when i create a debug script and use p $game_variable[2] i get "C://Pandora Test//Save//"

based off this, am i doing something wrong, i've spent 4 years on Pandora and it's near completion, this is the last thing i need on my Pandora Achievement Script in RMXP before it's done

ForeverZer0

Its how you are saving it. Ruby is not adding the double slashes. I made a text doc in a project with a few directories listed, then used a simple "p IO.readlines('test.txt')" and printed an array of strings just as I wrote them. Look at the way you are saving them, double slashes are only needed for writing to text files when they go the other way (\\).

"\" is an escape character, so in order to actually write it to a file, you need 2, but that is not the case with "/". A single one will write just fine.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Blizzard

There is something very wrong with your initial idea. How are you supposed where the save location is if the save location is stored in a save file (with the $game_variables which are different for every savegame, BTW) and you have no way of knowing where the savefile with the right $game_variables is supposed to be?
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Memor-X

Quote from: Blizzard on June 16, 2011, 02:12:55 am
There is something very wrong with your initial idea. How are you supposed where the save location is if the save location is stored in a save file (with the $game_variables which are different for every savegame, BTW) and you have no way of knowing where the savefile with the right $game_variables is supposed to be?


like i said, i got a New game Plus script that fixes that problem, a NPGdata.rxdata file contains the data of switches and variables which overwrites the original ones, ofcause only certain switches and variables do that, i know it works cause i'm loading the save location to the variable before the title screen and it remains the same when i go new game, this is the default new game mine you, not an edited one, plus i've used this script in a test project just to see if i could carry this data between games and it worked

i got the file saving to it's new location but now i got another problem, it not showing up in the save list after i save and on the title screen the continue option lights up but none of the files show up, it says it can't find the file and when the error message tells me what file it's trying to find, it only seems to output the data i have in the variable despite the fact that make_filename return $game_variable[2] + "Save{i+1}.rxdata"....or something like that, i can't remember off the top of my head what's in that last string but i havn't change it

nathmatt

thats because it should be
"Save#{$game_variable[2]}.rxdata"
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Memor-X

Quote from: nathmatt on June 17, 2011, 12:24:13 pm
thats because it should be
"Save#{$game_variable[2]}.rxdata"



how is that, by default it's "Save#{file_index + 1}.rxdata" (in my last post I had i, that was a mistake) and from my understanding, the file_index + 1 added the number at the end of the save thus getting you the 4 save games in the root directory depending on the slots you save them in, if i put $game_variable[2] in where the file_index + 1 is then i'll get a filename like SaveC:/Pandora Test/Save/.rxdata no doubt getting an error at the : because filenames can't have : in them

ForeverZer0

I agree with Blizz. Your entire concept from start to finish is flawed. There are FAR better and easier ways to do this. All this using variables to hold filepaths, etc. is just a mess. Your turning something relatively simple into a confusing mess.  In fact, you could easily do this without any saving of files. Create a variable in whatever class you like that gets saved, like Game_System or something. A simple boolean that tells if the game was completed or not telling if it can be used as a New Game+ file.

From there, a few very minor edits to creating a new game to load some files from the other game instead of the initialing new ones and your done. If you have to, you can also make any changes if they are needed, like removing the ultra powerful weapons, keys, quest items, or whatever.

Step back, and rethink your entire approach and forget the whole variable thing.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Memor-X

but the variable thing should be simple, the original saving saves the files in the root directory of the game, adding $game_variable[2] + before the string and storing a file path in that variable should just add the path before the string, that's simple enough and like i said, it's making the file now but it's not showing up in the list

i think i should explain what Pandora does
When you run Pandora, you can launch games though it, kinda like Blizzard's Multi-Game Launcher he made, in Pandora you have Profiles, a Guest Profile and other user created ones, when you go to run a game from Pandora, Pandora writes a file in the game's directory, this contains the name of the Profile and the path to where their save games are stored.

in the game (made in RMXP) it reads this file, if the user is "Guest", it saves the .rxdata file in the root directory by giving $game_variable[2] a value of "" which is a blank string, if not, then the path is put into the variable insted, and i know strings in RGSS can be concatenated cause Blizzard does it in StormTronics CMS, how else would you be able to define the save file name and extension

what i've done is uploaded a demo project, i've changed it so it's not importing the path from a file and not using my Pandora Script but the functionality in temrs of the saving is still the exact same and it's producing the exact same problem as i was talking about, here it is

http://www.megaupload.com/?d=GMXBLIG9

you'll need to create the filepath C:/Pandora/Test/Saves otherwise you will get an error when it tries to save, or you can change the file path in the event of map 2 also, the def self.make_filename is there so i can use the function outside Scene_File since Pandora isn't a child of Scene_File but it still needs use of the function, it's for another thing unrelated to this problem for the time being

nathmatt

My bad when you said location I thought it was the position the save file was saved not the folder location
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script