Go to Page... |
Thread Tools | Display Modes |
01/26/16, 03:30 PM | #21 |
|
I tried what you said before votan, and its actually just corrupting the table, even a fresh one.
first we call Lua Code:
and this is AWSV Lua Code:
then we call Lua Code:
and it does this to CharSV Lua Code:
Looks like the meta data is getting copied too. if I try this instead Lua Code:
then we get only Lua Code:
Basically I want the data between AWSV and the current CharSV to be synced when account_wide is enabled, and not synced when its not. It doesn't have to be synced all the time, only when changing account_wide, basically what you where trying to do in post 15. Last edited by Terrillyn : 01/26/16 at 06:10 PM. |
01/26/16, 04:17 PM | #22 | |
I check that tommorrow. And by the way my nickman is votan, not voltan. I have nothing to do with Flash Gordon |
||
01/26/16, 06:12 PM | #23 | ||
|
If you'd like I can send you the current addon zip to test?
Last edited by Terrillyn : 01/26/16 at 06:17 PM. |
||
01/27/16, 01:25 AM | #24 |
Ah, I see. The ZO_SavedVars is not the raw table of the saved variable and contains metadata.
Next try is to access the raw tables: Code:
local esoAccount = SimpleXPBar_Settings["Default"][GetDisplayName()] SimpleXPBar.esoAccount = esoAccount SimpleXPBar.rawCharSV = esoAccount[GetUnitName("player")] SimpleXPBar.rawAWSV = esoAccount["$AccountWide"] Lua Code:
Not as transparent to the internal structure, but... Last edited by votan : 01/27/16 at 02:06 AM. |
|
01/27/16, 06:45 AM | #25 | |||
|
Also, SV version should be number. Not that it's very useful, but if you ever need to go beyond "9", be prepared for an unpleasant surprise.
I'd solve the whole thing in a completely different way, but technically the only thing that's wrong with your original code is that ZO_DeepTableCopy copies metatables and you probably don't want that in this case, as it can mess with ZO_SavedVars magic. So you'll be better off writing your own RawDeepTableCopy. Other than that, you should've focused on the color picker: Lua Code:
|
|||
01/27/16, 03:31 PM | #26 | |||
|
I know, I did this at the time to see if it was something wrong with the character name.
---- Finally figured out how to make a copy of the SavedVars table without metadata Lua Code:
So I can call it like this Lua Code:
Then I looked up ZO_SavedVars:New -> CreateExposedInterface and apparently just setting the savevars version to nil will cause it to get nuked on the next load, and here we get: Lua Code:
Lua Code:
yay! Last edited by Terrillyn : 01/27/16 at 03:43 PM. |
|||
01/28/16, 09:33 PM | #27 |
|
As merlight said ZO_DeeptableCopy doen't copy metatables. Just copy from/to _G instead of trying to copy SimpleXPBar.AWSV or SimpleXPBar.CharSV
and you don't need SimpleXPBar.accountwide_settings, you can use SimpleXPBar.AWSV
Warning: Spoiler
Lua Code:
|
01/29/16, 02:23 PM | #28 | |
|
It doesn't seem like you read any of the posts here:
I appreciate any help I got, thank you all, but how do I mark this thread solved? Last edited by Terrillyn : 01/29/16 at 02:25 PM. |
|
01/29/16, 04:52 PM | #29 |
Change the thread's name to "[SOLVED]Having issues creating an account-wide settings toggle" maybe.
Edit: Just tested it and you are only able to edit the title of your first post in your thread :-( So just write a BIG GREEN "SOLVED" at your first thread's post start? Last edited by Baertram : 01/29/16 at 04:55 PM. |
|
01/29/16, 10:13 PM | #30 | |
|
From your post it appeared you wanted to create a toggle that swaps between character & account wide settings and you wanted to copy the current acccountwide saved vars to the character saved vars to sync them. If something else was added later or changed your right I missed it. I understand you wanted to copy through the metatable. I just went around it, all of that metadata is stored in _G which is what I copied. _G is up-to-date when you change settings, that code works. I'm guessing you had zgoo open and you were checking your SimpleXPBar.CurSV table after the swap/copy which would show the settings were out of date because zgoo would still be referencing the old table from before the swap. You can't just open & close the saved var table, you have to close zgoo & re-run /zgoo xxx after the swap for it to show the updated settings. I'm glad you got it to work though. |
|
01/30/16, 01:28 AM | #31 | |
|
The attached picture should tell why I think this, maybe I'm wrong though. In the picture CurSV is AWSV which should have the same values as $AccountWide, but $AccountWide has outdated values if I change something. Last edited by Terrillyn : 01/30/16 at 01:36 AM. |
|
01/30/16, 02:50 AM | #32 | |
|
Lua Code:
The picture you posted is comparing CurSV & _G["xxxxx"]["Default"][sDisplayName]["$AccountWide"] Those are not the same tables, they shouldn't have the same ID's. Last edited by circonian : 01/30/16 at 02:58 AM. |
|
01/30/16, 02:59 AM | #33 | |
That's why I suggested to use access the saved variable directly before wrapping in comment 24. Take a look at CreateExposedInterface to see, that there are actually two more tables involved. You should find the reference to your table within CurSV. |
||
01/30/16, 03:19 AM | #34 |
|
Thank you for your patience, I get it now.
I also see were some of my confusion was coming from, there must be a bug with the DeveloperSuite*, as its giving old data until I actually access said data with the console, weird. |
01/30/16, 06:24 AM | #35 | |
I think DeveloperSuite does best possible for an addon. It is not a JIT debugger from vendor. |
||
ESOUI » Developer Discussions » Lua/XML Help » Having issues creating an account-wide settings toggle |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|