Game's Save File Location

Discussion in 'RGSSx Script Support' started by Kuro Neko, Jun 18, 2014.

Thread Status:
Not open for further replies.
    Tags:
  1. Kuro Neko

    Kuro Neko Veteran Veteran

    Messages:
    173
    Likes Received:
    15
    First Language:
    English
    The default game save is: Game's Name/savexx.rvdata2. I want to change the save location to: Game's Name/Save/savexx.rvdata2. So, i've changed this part in game's script: DataManager

    #-------------------------------------------------------------------------- # * Determine Existence of Save File #-------------------------------------------------------------------------- def self.save_file_exists? !Dir.glob('Save*.rvdata2').empty? end #-------------------------------------------------------------------------- # * Maximum Number of Save Files #-------------------------------------------------------------------------- def self.savefile_max return 16 end #-------------------------------------------------------------------------- # * Create Filename # index : File Index #-------------------------------------------------------------------------- def self.make_filename(index) sprintf("Save%02d.rvdata2", index + 1) endTo this:

    #-------------------------------------------------------------------------- # * Determine Existence of Save File #-------------------------------------------------------------------------- def self.save_file_exists? !Dir.glob('Save/Save*.rvdata2').empty? end #-------------------------------------------------------------------------- # * Maximum Number of Save Files #-------------------------------------------------------------------------- def self.savefile_max return 16 end #-------------------------------------------------------------------------- # * Create Filename # index : File Index #-------------------------------------------------------------------------- def self.make_filename(index) sprintf("Save/Save%02d.rvdata2", index + 1) endAnd, it's work, the save will be located in Save folder instead of right in the game's folder. But, the problem is, i've to create a save folder before, so the game will be saved in that save folder. If there isn't any save folder, the game won't be saved. All i want is, the game will check either there is a game folder or not and if not, create one and save in that.
     
    #1
  2. ??????

    ?????? Diabolical Codemaster Veteran

    Messages:
    6,264
    Likes Received:
    2,313
    Location:
    Your OS
    First Language:
    Binary
    Primarily Uses:
    RMMV
    FOLDER_NAME = "NAME"Dir.mkdir(FOLDER_NAME) unless Dir.exist?(FOLDER_NAME)
    Not at my comp right now so this may not be 100% accurate. Its something like that though.
     
    #2
    Zeriab likes this.
  3. Kuro Neko

    Kuro Neko Veteran Veteran

    Messages:
    173
    Likes Received:
    15
    First Language:
    English
    Oh, Dekita :D

    Where should i put that line?
     
    #3
  4. ??????

    ?????? Diabolical Codemaster Veteran

    Messages:
    6,264
    Likes Received:
    2,313
    Location:
    Your OS
    First Language:
    Binary
    Primarily Uses:
    RMMV
    probably best to put it into the module and have it run as soon as the game runs.
     
    #4
  5. Kuro Neko

    Kuro Neko Veteran Veteran

    Messages:
    173
    Likes Received:
    15
    First Language:
    English
    Oh, it's work. Thank you :D

    You know, you like a hero appeared everytime i need LOL :D
     
    #5
    ?????? likes this.
  6. ??????

    ?????? Diabolical Codemaster Veteran

    Messages:
    6,264
    Likes Received:
    2,313
    Location:
    Your OS
    First Language:
    Binary
    Primarily Uses:
    RMMV
    ahh good, it worked.

    I feared that the syntax may have been

    Dir.mk_dir(FOLDER_NAME)(with an underscore ' _ ')

    Havent used the Dir class since I done my own save data script :p
     
    #6
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,911
    Likes Received:
    11,583
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
     
    #7
Thread Status:
Not open for further replies.

Share This Page