Creare Videogiochi - Game Developer
Data Backup RmXp - Versione stampabile

+- Creare Videogiochi - Game Developer (https://www.making-videogames.net/giochi)
+-- Forum: Rpg Maker Italia (https://www.making-videogames.net/giochi/Forum-Rpg-Maker-Italia)
+--- Forum: Rpg Maker Xp (https://www.making-videogames.net/giochi/Forum-Rpg-Maker-Xp)
+---- Forum: Script Rpg Maker Xp (https://www.making-videogames.net/giochi/Forum-Script-Rpg-Maker-Xp)
+---- Discussione: Data Backup RmXp (/thread-Data-Backup-RmXp)



Data Backup RmXp - seingh - 03-05-2010

Backup

Autore: Io, il mio primo script

Descrizione: Con questo script potrete recuperare i dati persi...


Incompatibilità e Bug noti:
Niente imcompatibilità: perchè non interragisce con nessuno script

Bug: Si è presente il seguente bug:
Questo script crearà una cartella chiamate backup_data, ma in essa non verrà fatta distinzione tra giorni e i file verranno sovrascritti.

Script:

Codice:
#===============================================================By seingh
#--------------------------------------------------------------

module WData_Backup
  
  BACKUP_WHEN_TEST = true
  BACKUP_REPORT = true
  DIRNAME = "Backup_Data"
SCRIPT = <<_SCRIPT_
    if (BACKUP_WHEN_TEST && #{defined?(Graphics.wait) ? '$TEST' : '$DEBUG'}) ||
    !BACKUP_WHEN_TEST
      time = Time.now
      Dir.mkdir(DIRNAME) unless File.directory?(DIRNAME)
      ftype = "#{defined?(Graphics.wait) ? 'rvdata' : 'rxdata'}"
      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 Script, personaggi, e settaggi vari creato: ' + (Time.now - time).to_s + ' secondi') if BACKUP_REPORT
    end
_SCRIPT_

  eval(SCRIPT) unless $@
end

Risolvere il bug:
Ogni volta che fate il test entrate nella cartella Backup_Data e create delle sottocartelle per esempio 1
e mettete i file della prima volta.
Dopo quando si rifà il test, i file vengono creati, ma gli altri non vengono cancellati.
Lo so è molto lento da fare ma è l'unico modo che conosco
non mi modificate il topic xD cmq funzia anche sul vX



RE: Data Backup RmXp - friskon - 03-05-2010

Big Grin vabbè era tutto sgranato, per inserire codice c'è il tasto cancelletto # accanto a quote, Grazie del contributo!


RE: Data Backup RmXp - GX97 - 03-05-2010

bellissimo, da convertire per VX... anche perché è il più corto script che vedo... (è un pregio)Big Grin


RE: Data Backup RmXp - seingh - 03-05-2010

xD cmq questo era il mio primo script ^^
PS per gx: funziona anche sul vx