Recent Additions to 'Changing/Updating Saved Variables'http://wowprogramming.com/forums/development/811.rss
http://wowprogramming.com/forums/development/811/5
forums/development/811/5forums/development/811/5Wed, 02 Oct 2013 18:41:16 +0000jnwhitehI do not understand your question, or I've already answered it.
If you add a SavedVariable as 'MyAddonDatabase'.
Once in-game, you set the value of this to something:
MyAddonDatabase = "This is a monkey"
When you reload it should be saved. You can reload and `/dump MyAddonDatabase` and should see the right value. If you're trying to display the stored value in your edit box, you need to do what I told you to, register for the `ADDON_LOADED` event with the first argument as your addon name. In response to that event, the value should be available and you can update the contents of the edit box.http://wowprogramming.com/forums/development/811/4
forums/development/811/4forums/development/811/4Wed, 02 Oct 2013 09:18:00 +0000newbie> If you name the variable HelloWorld, it has to be called HelloWorld. You can't wrap it in a table, it has to exist at the name `_G['HelloWorld']`, which yours does not. That's why its not being saved.
Sorry the forum post I made is wrong, I was writing a bit too fast, the variable in my addon is correct, it's saving fine, but you didn't answer my question, how can I overwrite the saved variable ?
http://wowprogramming.com/forums/development/811/3
forums/development/811/3forums/development/811/3Tue, 01 Oct 2013 20:22:22 +0000jnwhitehIf you name the variable HelloWorld, it has to be called HelloWorld. You can't wrap it in a table, it has to exist at the name `_G['HelloWorld']`, which yours does not. That's why its not being saved.http://wowprogramming.com/forums/development/811/2
forums/development/811/2forums/development/811/2Tue, 01 Oct 2013 08:58:25 +0000newbie> I am not sure that I understand your question fully. If you've stored some saved variables and you want to know when they are loaded so you can utilise those values, you can wait for the `ADDON_LOADED` event where the first argument is the name of your addon-- that's when they are available. It's up to you to manually do whatever you want to do with those values at that point.
Ok I will try to explain it better.
Let's say that saved variable is called HelloWorld, (adding the saved variable to .toc and create a table for the settings)
settings = {
HelloWorld = "This is the default Hello World Message.",
}
Now I have a user EditBox, where I want the user to either have that default message or their own message. It works fine to load the message and display it in the EditBox like so:
`
EditBox:SetText('settings.HelloWorld');
`
Ok, so the EditBox is now showing the default value from the variable HelloWorld.
Now when I try to edit the EditBox, with a diffirent message let's say "Hello New Message".
Then I will see the "Hello New Message" my entire login session in Wow, but once I logout the "Hello New Message" doesn't save, in my:
_WTF/Account/NAME/SERVER/CHARACTER/example.lua , I will still see the old message HelloWorld = "This is the default Hello World Message." But I want it to change to "Hello New Message".
I hope I made it more clear now :)
http://wowprogramming.com/forums/development/811/1
forums/development/811/1forums/development/811/1Tue, 01 Oct 2013 04:34:57 +0000jnwhitehI am not sure that I understand your question fully. If you've stored some saved variables and you want to know when they are loaded so you can utilise those values, you can wait for the `ADDON_LOADED` event where the first argument is the name of your addon-- that's when they are available. It's up to you to manually do whatever you want to do with those values at that point.