Thread Tools Display Modes
04/18/14, 04:23 AM   #1
Garb_Paratus
Join Date: Apr 2014
Posts: 1
Unable to get the SaveVariable to work with MyFirstAddon

Hi all,

Was having a great time and learning how things work playing around with my addon(as you do).

Once I had my addon doing what I wanted. I figured I would add save/load functionality for the background and controls so if someone moved it I could put it back on next load along with 2 other variables and call it complete. Then it all went bad.

I have tried to merge http://wiki.esoui.com/MyFirstAddon_tutorial with the SavedVariablesDemo on this website http://www.esoui.com/downloads/info1...ablesDemo.html

As don't know it all, I eventually ended up stripping SavedVariablesDemo down and adding bits from MyFirstAddon until it broke. This is where I need the help (and perhaps an explaination)

The controls section of the SavedVariables.xml file appears to be the problem. Can someone explain why when I add back in the code below it will not save, but if I take it out saving works fine?


<Controls>
<Backdrop name="$(parent)BG" inherits="ZO_ThinBackdrop" />
<Label name="$(parent)Counter" font="ZoFontWindowTitle" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="Updating: ">
<AnchorFill />
</Label>
</Controls>

I read the section on http://wiki.esoui.com/AddOn_Quick_Questions about adding savedVariables, but the terminology is not clear for me e.g. In your initialize:

EVENT_MANAGER:RegisterForEvent("MyAddOn", EVENT_ADD_ON_LOADED, OnAddOnLoaded)

does someone have a full copy of Myfirstaddon with saving variables that works, they are willing to email or post?

Thanks In Advance,
Garb_Paratus.
  Reply With Quote
04/18/14, 04:44 AM   #2
Vicster0
 
Vicster0's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 82
Have you tried looking over this page? http://wiki.esoui.com/AddOn_Quick_Questions

I found that when I was first trying to understand the settings for AddOns that this (along with dissecting a few other addons) was tremendously helpful.

I'm sure you know this too but that line of LUA code you posted is for initializing the addon and doesn't necessarily have anything to do with loading the settings. The magic of loading settings happens in this sort of statement:

Lua Code:
  1. local savedVars = ZO_SavedVars:New(savedVariableName, version, namespace, defaults, profile)

Good luck!
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Unable to get the SaveVariable to work with MyFirstAddon


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