The Lurker Lounge Forums
SavedVariables.lua file - Printable Version

+- The Lurker Lounge Forums (https://www.lurkerlounge.com/forums)
+-- Forum: Lurker Games (https://www.lurkerlounge.com/forums/forum-6.html)
+--- Forum: World of Warcraft (https://www.lurkerlounge.com/forums/forum-16.html)
+--- Thread: SavedVariables.lua file (/thread-6775.html)



SavedVariables.lua file - LochnarITB - 03-19-2005

I'm using Cosmos and was having some problems after yesterday's update. I had not been allowing the updater to clean the interface addons directory. The solution, as found on the Cosmos forums, was to let the directory be cleaned. They indicated that an AddOn.nopatch file had to be created for each non-Cosmos addon to prevent it from being cleaned. I read it as putting the files in the FrameXML directory. That didn't work. They are to be placed in the first level of the addons directory. Because it didn't work, a couple addons were cleaned out. The two that this caused problems for were QuestHistory and BankItems. There is an automatic flush mechanism that removes data in SavedVariables.lua for any addons not being used. It flushed all my data for the two addons. Because I hadn't realized that had happened, WoW was run another time with the flushed data. The problem with that is that a SavedVariables.lua.old file is created as a backup. The backup was now flushed as well. I lost my quest history and bank items info for all my characters. The bank items will be restored to the addon by simply visiting each account's bank. The quest history is lost. :( That brings up my question.

Does anyone know of a utility/addon that would make and retain multiple backups of SavedVariables.lua? I would like to see something that, at each load or exit of WoW, would create a backup named something like SavedVariables.lua.YYYYMMDDHHMM. An incident such as this would then just require a copy and rename of a backup file to be back to where I was.

BTW, I searched through the WoW forums to see if there was any reference to something like this. I saw references to manually backing it up but not a utility. Posting on that forum is almost pointless with the speed that things scroll off the front pages. I try to visit that place as little as possible anyway. It is the kind of place where you dash in and get your business done and dash back out. :wacko:


SavedVariables.lua file - Quark - 03-19-2005

Here's something I cooked up in a few minutes, maybe it can be made better eventually. Just stick this into a batch file (say, "backup.bat"), and run it with "backup.bat ACCOUNTNAME". Note this assumes the standard install directory.

So for me, it would be "backup.bat QUARK" and it would back up SavedVariables.lua.
Code:
xcopy "C:\Program Files\World of Warcraft\WTF\Account\%1\SavedVariables.lua" "C:\Program Files\World of Warcraft\WTF\Account\%1\SavedVariablesBackup\" /I /Y
If I see or make anything anything better I'll be sure to post it here.


SavedVariables.lua file - LochnarITB - 03-20-2005

This would only give me one copy of the file. If I didn't notice that information had been flushed it would be easy to write a bad backup too. I played around with your idea some more. I put this in my backup directory as a batch file named svbackup.dat:

Code:
@echo off
echo .
echo enter svbackup YYYYMMDDHHMM
echo .
pause
xcopy "C:\timstuff\games\worldofwarcraft\WTF\Account\lochnar\SavedVariables.lua" "C:\timstuff\games\worldofwarcraft\svbackup\" /Y
rename SavedVariables.lua SavedVariables.%1.lua
I then made a command prompt icon that points to that directory. I open the command prompt and type svbackup and the date and it copies and renames a backup of the file. I could actually use any other identifier I wanted as long as I typed the word after the svbackup. The echoes are just a reminder. If I haven't entered an identifier, it doesn't hurt anything. It just creates a file named with an extra period. Not as simple as simply clicking an icon, but it seems to work.

[edit] Forgot to point out that anyone using addons to gather data should be backing up this file. I realized today that I also lost my map notes - npc's, monster farming points, etc. This is the information we create that isn't on the servers like all our character data is.


SavedVariables.lua file - Malakar - 03-20-2005

This should do the trick for Win2k, don't know about other versions of windows.

Code:
@echo off

for /f "tokens=2-4 delims=/ " %%a in ("%DATE%") do set DATE=%%c-%%a-%%b
for /f "tokens=1-3 delims=:." %%a in ("%TIME%") do set TIME=%%a-%%b-%%c

mkdir "SavedVariables Backups"

copy "SavedVariables.lua" "SavedVariables Backups\SavedVariables__%DATE%_%TIME%.lua"

It references the files relatively, so it's not dependent on your directory structure, but it needs to be run from the directory which contains the SavedVariables.lua file you want to backup. You could of course change that if you want, or make a shortcut to run it from that location more easily.

Note that the date/time format in this code is changed to YYYY-MM-DD_HH-MM-SS.


SavedVariables.lua file - LochnarITB - 03-20-2005

Thanks! It works under XP. I was going on my mostly forgotten use of DOS batch files and I couldn't figure out the date business. The parsing you set up did the trick. I modified it to run from the backup directory that already existed and format the date and time differently but now I have a batch file icon that does all the work. One click goodness. :D


SavedVariables.lua file - Xanthix - 03-21-2005

Just a note that you could save time by adding the command to start WoW to these batch files. Then instead of doing the backup before starting the game, you could just double-click the batch file, and it would automatically backup your SavedVariables and then start the game for you. If you replace your desktop/start menu shortcut for WoW with one for the batch file, you will create a backup each time you start the game.


SavedVariables.lua file - LochnarITB - 03-21-2005

Xanthix,Mar 20 2005, 07:58 PM Wrote:Just a note that you could save time by adding the command to start WoW to these batch files.
[right][snapback]71350[/snapback][/right]
That's a good idea but I don't want a backup every time I start WoW. I'd end up with a full hard drive :( . I tend to jump out a few times a night. I would also have to make it run Cosmos which would then run WoW and I'd hate to introduce one more thing that can go wrong. I can live with one extra click. It's the digging through directories and copying and pasting that I wanted to avoid. It works well now. Thanks for the replies.