Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

(my frist script) Save to external drive

This i got help from a friend with to do. Its my very first edit. It changes the save file type and where it saves to (If J:\ drive is present, it saves to that, if it isn't present, it saves to the normal file.)
It requires editting two scripts (Scene_File and Window_SaveFile).

(dont make fun of me, this is the first time ive tried doing a script so Its only a small edit)

In the Window_SaveFile change the line that starts with @filename(line 22) with
Code:
    @filename = "Data#{file_index + 1}.SaveGame"

And Scene_File, change line 108 down to

Code:
  def make_filename(file_index)
    if File.exist?("G:")
    return "G:\Data#{file_index + 1}.SaveGame"
    if File.exist?("J:")
    return "J:\Data#{file_index + 1}.SaveGame"
  else
    return "C:\Data#{file_index + 1}.SaveGame"
    end
  end
end

Thanks to icedmetal for helping with this. Tell me if there is any errors with this so i can attempt to fix them. (I know this is kinda useless, but It would be cool to use for something like a memory card type thing.)
 
At first, I thought this'd be pretty useless, but then I got an idea... you need to confirm that one for me, though...
What about you'd burn your game and all files and that on a CD and apply this script to save your files to the hard drive. Would this work in theory or are there any other files needed to be stored on the HDD? (I never thought about things like that...)

PS: You shouldn't save stuff in the HDD:\ directory itself... better create a subfolder, best let the user decide where he wants the files to be saved.
 
Actually, I think if you put C:\ in front of the save files name, you can make it so it saves onto a computer instead of attempting to add it to a burned cd. I think that would work. Just use this for both of those scripts in those parts C:\Data#{file_index + 1}.SaveGame and itll save it to the C:\ drive, or you can put an entire line in front of that like C:\Program Files\ and itll save into the program files folder.
 
Well you should look for the default RPG Maker path installation, and create a new folder there to store any savefiles. Like, if your installation is in C:\Program Files\Enterbrain\RPG Maker XP, you should put your saved files in C:\Program Files\Enterbrain\RPG Maker XP\Saves\*name_of_the_game_here*. So that idea of burning the game in a CD and running it from there would work. Saving in the root or in a random path is something very abstract...

Now, the problem is to check in which path the RPG Maker XP is installed, because not everyone installs them in the default path (like me). I´m sure that this can be checked in the Windows Registry, but i just don´t know how...

BTW, neat idea, and a good script you have. Just needs some refinement ^^
 
Im not sure. Thats why i said just make it run off the cd, and make it so that it saves to the C:\ or C:\Prgram Files. But if you do make it so it saves to the enterbrain file, have it so it says that, that way people are a aware of it being saved to a file on the computer that needs to be in that spot. like if it saves to the enterbrain file, just tell them to make a file named Enterbrain if it isnt already saved in the program file. or, you can try to find a way of it to make a new file. Or, if you see how i have it so that it says def make_filename(file_index)
if File.exist?("G:")
return "G:\Data#{file_index + 1}.SaveGame"
if File.exist?("J:")
return "J:\Data#{file_index + 1}.SaveGame"
else
return "C:\Data#{file_index + 1}.SaveGame"
end
end
end

Add one that says
if File.exist?("C:\Program Files\Enterbrain")
return "C:\Program Files\Enterbrain\Data#{file_index + 1}.SaveGame"

and that might work. (place above the else
 
The problem is that the same G: or J: that may be a HDD in some computer, may be a CD-ROM Drive, or any write-protected media. And some roots can be protected by the system. My suggestion would be to write it only in one path, in this case C:/Data. I still think that saving in the default RMXP path installation would be perfect, but i still have to figure out how to take the string with that path in the Registry... ^^
 
You could add an entry form for the player to choose where to save the file. [Example: Player types C:\Save\ or F:\Data]
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top