Thread Tools Display Modes
09/12/20, 09:03 AM   #1
CoffeeMonster42
Join Date: Sep 2020
Posts: 2
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.

Last edited by CoffeeMonster42 : 09/12/20 at 09:35 AM.
  Reply With Quote
09/12/20, 09:32 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
How does your manifest.txt look like and when do you call Initialize?
  Reply With Quote
09/12/20, 09:38 AM   #3
CoffeeMonster42
Join Date: Sep 2020
Posts: 2
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

Last edited by CoffeeMonster42 : 09/12/20 at 09:44 AM.
  Reply With Quote
09/14/20, 03:28 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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

Last edited by Baertram : 09/14/20 at 03:35 AM.
  Reply With Quote
09/15/20, 01:50 AM   #5
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by Baertram View Post
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.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Saved variables not saving

Thread Tools
Display Modes

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