Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================
- # ● [VXA] ◦ Auto-Backup VX Ace ◦ □
- #--------------------------------------------------------------
- # ◦ by Woratana [woratana@hotmail.com]
- # ◦ Thaiware RPG Maker Community
- # ◦ Originally released on: 07/12/2008
- # ◦ Ported to VX Ace by Mr. Bubble on: 27/12/2011
- #--------------------------------------------------------------
- # ◦ Features:
- # - Automatically backup your rvdata2 files when you run the game.
- # - Now in VX Ace, the Backup Report will appear in the debug console.
- #--------------------------------------------------------------
- # ◦ How to use:
- # - Setup the script below,
- # - You may want to run your game now to backup data files the first time.
- #--------------------------------------------------------------
- module WData_Backup
- BACKUP_WHEN_TEST = true # (true/false) Do you want to backup data files only
- # when running game through editor (When you press F12 in editor) ?
- BACKUP_REPORT = true # (true/false) Show textbox when backup process finish?
- DIRNAME = 'Backup_Data' # Name of the backup folder
- # (Script will automatically create folder if it doesn't exist)
- SCRIPT = <<_SCRIPT_
- if (BACKUP_WHEN_TEST && '$TEST') ||
- !BACKUP_WHEN_TEST
- time = Time.now
- 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
- p('Backup Finished!: ' + (Time.now - time).to_s + ' sec') if BACKUP_REPORT
- end
- _SCRIPT_
- eval(SCRIPT) unless $@
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement