update character variable on all chars at once?
Looking for a way to update char saved variables all at once while logged into only one toon.
I'm currently running mostly an account wide setup but have a few char specific variables id like to reset at server daily reset. I'm currently saving the per char variables like this: Code:
ZO_SavedVars:NewAccountWide( MyAddon.svName, MyAddon.svVersion, GetUnitName("player"), defaultSavedCharVars ) Code:
function MyAddon.ResetCharacterData() |
SV is a global table with the name you specify at the txt file per ## SavedVariables: <globalName>
So your can read your sv file on the disk and you see the contents like <globalName> = { ["@AccountName"] = { ["Charactername here"] = { .... Just update it like this then: <globalName>["@AccountName"]["Charactername here"]["variableName"] = xyz |
Quote:
my variables are setup like this: Code:
MyAddon.savedVariables = ZO_SavedVars:NewAccountWide( MyAddon.svName, MyAddon.svVersion, nil, defaultSavedVars ) |
Please re-read what I described above!
I'm not talking about your ZO_SavedVars wrapper which you're already using. I'm talking about "global tables" in lua code! The ZO_SavedVars wrapper just handles the GetDisplayName() to get your @AccountName and GetCurrentCharacterId() to get the characterId for you and then updates the "global SV able of your addon, specified at ## SavedVariables: <globalTableName>" for you. But <globalTableName> can be read and changed directly too! Try /tbug <globalTableName> and you see your SV table in merTorchbug. Try /tbug MyAddon.charVariables to see the difference where ZO_SavedVars was used as a wrapper around the table. Check your SV file on the disk to get the correct table name, subtables etc. and then simply access it like described, directly, without ZO_SavedVars usage or any pointer variable like your MyAddon.charVariables or MyAddon.savedVariables You can do both: With ZO_SavedVars and without, even at the same addon. |
TY and I have been re-reading it. But.. Ive decided to revert back to a simple single acct wide variable. TY for all the help :)
|
All times are GMT -6. The time now is 09:12 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI