Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Backup Module (1.0)
- # 19/02/2012
- # By Pacman (inspired by Woratana)
- # -----------------------------------------------------------------------------
- # This script will backup your data files (i.e., files in the Data folder
- # of your game directory) and store them in a new folder. You may designate
- # if the backup occurs at the very start of any testing session and what
- # directory it saves to.
- # You may also backup manually in-game (if you want to do that for some reason)
- # with the script call:
- # backup(dir)
- # Where dir is the directory (in quotation marks) specified to put the backup.
- # Dir defaults to the directory set in the configuration, so you don't need
- # to include it.
- # I advise you don't use this command in the final release of your game,
- # especially if you plan on encrypting it. This script is for testing purposes
- # only. Setup below.
- #
- # -----------------------------------------------------------------------------
- module BACKUP # Do not touch this line.
- BACKUP_WHEN_TEST = true # Backup on test session?
- DIRNAME = 'Backup Data' # Directory backup will be saved to (will be created).
- # -----------------------------------------------------------------------------
- #
- # DO NOT EDIT PAST HERE
- #
- #===============================================================================
- SCRIPT = <<_SCRIPT_
- if (BACKUP_WHEN_TEST && #{'$TEST'}) || !BACKUP_WHEN_TEST
- Dir.mkdir(DIRNAME) unless File.directory?(DIRNAME)
- ftype = "#{'rvdata2'}"
- flist = Dir.glob('./Data/*.{' + ftype + '}')
- flist.each_index do |i|
- flist[i] = flist[i].split('/').last
- save_data(load_data('Data/' + flist[i]), DIRNAME + '/' + flist[i])
- end
- end
- _SCRIPT_
- eval(SCRIPT) unless $@
- end
- #==============================================================================
- # ■ Game_Interpreter
- #------------------------------------------------------------------------------
- # イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
- # Game_Troop クラス、Game_Event クラスの内部で使用されます。
- #==============================================================================
- class Game_Interpeter
- #--------------------------------------------------------------------------
- # * Manual Backup
- #--------------------------------------------------------------------------
- def backup(dir = BACKUP::DIRNAME)
- Dir.mkdir(dir) unless File.directory?(dir)
- ftype = "#{'rvdata2'}"
- flist = Dir.glob('./Data/*.{' + ftype + '}')
- flist.each_index do |i|
- flist[i] = flist[i].split('/').last
- save_data(load_data('Data/' + flist[i]), dir + '/' + flist[i])
- end
- end
- end
- $imported ||= {}
- $imported[:pac_backup]
- #===============================================================================
- #
- # END OF SCRIPT
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement