Advertisement
mrbubble

Auto Backup VX Ace

Dec 27th, 2011
1,462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.70 KB | None | 0 0
  1. #===============================================================
  2. # ● [VXA] ◦ Auto-Backup VX Ace ◦ □
  3. #--------------------------------------------------------------
  4. # ◦ by Woratana [woratana@hotmail.com]
  5. # ◦ Thaiware RPG Maker Community
  6. # ◦ Originally released on: 07/12/2008
  7. # ◦ Ported to VX Ace by Mr. Bubble on: 27/12/2011
  8. #--------------------------------------------------------------
  9. # ◦ Features:
  10. # - Automatically backup your rvdata2 files when you run the game.
  11. # - Now in VX Ace, the Backup Report will appear in the debug console.
  12. #--------------------------------------------------------------
  13. # ◦ How to use:
  14. # - Setup the script below,
  15. # - You may want to run your game now to backup data files the first time.
  16. #--------------------------------------------------------------
  17.  
  18. module WData_Backup
  19.  
  20.   BACKUP_WHEN_TEST = true # (true/false) Do you want to backup data files only
  21.   # when running game through editor (When you press F12 in editor) ?
  22.   BACKUP_REPORT = true # (true/false) Show textbox when backup process finish?
  23.   DIRNAME = 'Backup_Data' # Name of the backup folder
  24.   # (Script will automatically create folder if it doesn't exist)
  25.  
  26. SCRIPT = <<_SCRIPT_
  27.     if (BACKUP_WHEN_TEST && '$TEST') ||
  28.     !BACKUP_WHEN_TEST
  29.       time = Time.now
  30.       Dir.mkdir(DIRNAME) unless File.directory?(DIRNAME)
  31.       ftype = 'rvdata2'
  32.       flist = Dir.glob('./Data/*.{' + ftype + '}')
  33.       flist.each_index do |i|
  34.         flist[i] = flist[i].split('/').last
  35.         save_data(load_data('Data/' + flist[i]), DIRNAME + '/' + flist[i])
  36.       end
  37.       p('Backup Finished!: ' + (Time.now - time).to_s + ' sec') if BACKUP_REPORT
  38.     end
  39. _SCRIPT_
  40.  
  41.   eval(SCRIPT) unless $@
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement