ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Saved variables not saving (https://www.esoui.com/forums/showthread.php?t=9377)

CoffeeMonster42 09/12/20 09:03 AM

Saved variables not saving
 
Hi

My saved saved variables are not saving and i only ever get the default values
Here is the init function for my addon.

Code:

function ShutupRillis:Initialize()
        d("ShutupRillis loaded")
        ShutupRillis.savedVariables = ZO_SavedVars:NewAccountWide("ShutupRillisVars", ShutupRillis.variableVersion, nil, ShutupRillis.Default)
        CALLBACK_MANAGER:RegisterCallback("OnWorldMapChanged", ShutupRillis.OnZoneChanged)
        EVENT_MANAGER:RegisterForEvent(ShutupRillis.name,  EVENT_ZONE_CHANGED, ShutupRillis.OnZoneChanged)
        ShutupRillis.LoadSettings()
end

Edit: I think this became a problem when i changed the API version in the manifest.

votan 09/12/20 09:32 AM

How does your manifest.txt look like and when do you call Initialize?

CoffeeMonster42 09/12/20 09:38 AM

It was working before, not 100% sure but i think changing api version in the manifest broke it.
I was also trying to implement a settings menu with libaddonmenu2

was 100029 and then changed to 100033

calling initialize here

Code:

function ShutupRillis.OnAddOnLoaded(event, addonName)
               
        if addonName == ShutupRillis.name then
                ShutupRillis:Initialize()               
        end
end

EVENT_MANAGER:RegisterForEvent(ShutupRillis.name, EVENT_ADD_ON_LOADED, ShutupRillis.OnAddOnLoaded)

The manifest that i think caused the problem
Code:

##Title: ShutupRillis
## APIVersion: 100032 100033
##Version: 2.01
##DependsOn: LibAddonMenu-2.0
##SavedVariables: ShutupRillisVars

ShutupRillis.lua
Settings.lua


Baertram 09/14/20 03:28 AM

Check that the file encoding of your txt file is either ANSI or if the file contains umlauts or special chars like the (c) UTF-8 without a byte order mark (BOM), or you'll sometimes get into trouble (Addon not loaded, not loaded properly).

And afaik there needs to be a space after the ## in the txt file lines!

Code:

## Title: ShutupRillis
## APIVersion: 100032 100033
## Version: 2.01
## DependsOn: LibAddonMenu-2.0>=31
## SavedVariables: ShutupRillisVars

ShutupRillis.lua
Settings.lua

Forcing your addon to use the "newest library version", if older versions exist which could be still around, and fail to load then:
I've also added the verison check of LAM2 (>=31) so that your addon needs the newest LAM version to work properly.
As there exist several older LAM2 versions which will do not include the global Variable LibAddonMenu2 and would try to use the LibStub approach, you can struip loading them by forcing your addon to do a "version check" via your manifest txt file.

Information about libraries and the >=<version> can be found here:
https://wiki.esoui.com/Libraries#.23...ned_integer.3E

votan 09/15/20 01:50 AM

Quote:

Originally Posted by Baertram (Post 42254)
And afaik there needs to be a space after the ## in the txt file lines!

Good point. You can check this very easy. If your addon has no dependency to LAM2 (expand your addon in the extension menu), you need to change your manifest file.


All times are GMT -6. The time now is 10:24 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI