Thread Tools Display Modes
03-01-06, 11:40 AM   #1
Agrash
A Murloc Raider
Join Date: Mar 2006
Posts: 4
Saving SavedVariable

Hello there.

I wrote some little AddOns and all works fine.
I just have a little problem with SavedVariable when the game crash.

As you know, all SavedVariables will be saved when you logout your char session. That works fine for my Addons, no problem.

But, in case of game crash, no more variables will be saved.....

Can we force to save SavedVariables to disk (into the regular myAccount/SavedVariables/myAddOn.lua file) while the game is running ? I mean while you play with your char ?

The idea is to provide a 'Save' button with a script code that can force to save my AddOn variables on the disk

Thanks for help
  Reply With Quote
03-01-06, 01:02 PM   #2
Esamynn
Featured Artist
Premium Member
Featured
Join Date: Jan 2005
Posts: 395
The only way to force the game to write out Saved Variables without logging out is by reloading the interface. This is done to prevent AddOns from having any method of real time I/O.
  Reply With Quote
03-02-06, 11:03 AM   #3
Agrash
A Murloc Raider
Join Date: Mar 2006
Posts: 4
Oh ! It's for security issue off course

Thanks for your answer, so I know I can stop to search.
  Reply With Quote
03-02-06, 11:10 AM   #4
Esamynn
Featured Artist
Premium Member
Featured
Join Date: Jan 2005
Posts: 395
There have been attempts to get Blizzard to change SavedVariables so that they can be written out at sufficiently long or random intervals, or even buffering the values for a period of time before writing them at such intervals, in order to provide a better solution to the problem of the game crashing sometimes and loosing all your data. However, as of yet, these efforts have not drawn any sort of response from Blizzard either way to my knowledge.
  Reply With Quote
03-05-06, 10:39 AM   #5
kestralcoppernickle
A Defias Bandit
Join Date: Mar 2006
Posts: 2
Try figuring this addon out

Maybe this may be of some help. The addon Jotter K (http://www.curse-gaming.com/mod.php?addid=323) has added "save" functionality to the notepad which saves the text without reloading the ui. Perhaps you can have a look at their code?
  Reply With Quote
03-06-06, 08:14 AM   #6
Agrash
A Murloc Raider
Join Date: Mar 2006
Posts: 4
As I can see, the author provider a button 'Reload UI' to flush all SavedVariables on the disk.

As JBCC had said.

If you dont hit this button, all your notes wrote in this notepad-like will be lost.
  Reply With Quote
03-13-06, 05:11 AM   #7
Agrash
A Murloc Raider
Join Date: Mar 2006
Posts: 4
Another question about variables

Hello again.

I found that on WoWWiki site :
Originally Posted by Wiki
When the player changes his target there is a small delay before the global variable 'playertarget' is updated. This can be exploited and used for restoring your old target.

Example:
TargetUnit("unit")
CastSpell()
TargetUnit("playertarget") -- This will restore your old target because of the delay. It will not clear your target if you didnt have one.
My question is : can we store the Global variable 'playertarget' to use it later ?
That will be usefull for mages to retrieve a sheep de-sheeped.

First :
- the mage choice a target and clic a button
- the script store this target ID in a variable (for example 'thesheep')
- the script launch the sheep spell

Later (when the sheep broke)
- the mage clic a button
- the script target the stored target id /target(thesheep)
- the script launch the sheep spell

I downloaded some existing mod like SheepWatch, but this AddOn retrieve the sheep by storing the name of mob. Not ideal when we have more that one mob with the same name.

I searched on this forum about my question, but no success. I'm sure all ennemis in game have a unique ID, but can we store it ...

Thanks again for your help, very appreciated.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Saving SavedVariable


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off