Author Topic: filecopy with getdatetime overwriting  (Read 606 times)

I combined the RTB auto saver and the load method from speedkart to make a dedicated auto saver / loader.  It saves a backup, and copies that backup to make a timeline of them with time stamps.  However, copying the current backup keeps overwriting the same timestamped backup instead of generating another time stamped save file.

Code: [Select]
$TCRPG_backupFileName = "saves/autosaves/backup/backup_" @ strReplace(getWord(getDateTime(), 0),"/","-") @ "_" @ strReplace(getWord(getDateTime(),1),":","-") @ ".bls";

filecopy("saves/autosaves/autosave.bls" , $TCRPG_backupFileName);
(notice the time stamp vs the last modified date on the file)

Are you updating the global variable every time you're about to save the file?

Are you updating the global variable every time you're about to save the file?
wow, I wasn't. thank you

If you're using the same RTB-autosaver I got from someone, you may want to also fix the print saving.
Code: [Select]
%objData = %obj.getDatablock();
if(%objData.hasPrint)
{
%filename = getPrintTexture(%obj.getPrintID());
%filebase = fileBase(%filename);
%path = filePath(%filename);
if(%path $= "" && %filename $= "base/data/shapes/bricks/brickTop.png")
%printTexture = "/";
else
{
%ratio = strReplace(%filename,"Add-Ons/Print_","");
%ratio = strReplace(%ratio,"Add-Ons/print_","");
%ratio = getSubStr(%ratio,0,strstr(%ratio,"_"));
%printTexture = %ratio @ "/" @ %fileBase;
}
}
The script from RTB I have just has this
Code: [Select]
%print = (%brick.getPrintID() != 0) ? getPrintTexture(%brick.getPrintID()) : "";Which makes custom prints not save or something. I got fed up with my prints not saving.

If you're using the same RTB-autosaver I got from someone, you may want to also fix the print saving.
The RTB saver I'm using has different code without this problem.  If you'd like it, I can send it your way.