Having trouble with multiple frames and switching data between them.
Hi guys, my names Jumpercable, author of EZ Mount addon.
Ive been trying to find a way to add options to my addon using: InterfaceOptions_AddCategory() Im struggling to get the SavedVariablesPerChar into the options frame, and then any changes saved back when the player_logout event fires ( my belief is that it should auto write the savedvariables per char without any extra code ). The purpose of this is to let me load the savedvariablespercharacter and update the options frame based on saved variables. If the options are changed the variables are saved on logout. The slash command is what my addon uses to run from an ingame macro. Heres some code ive being trying to work with before adding it into my addon: Any advice here or if i can even do this, any help is appreciated. Code:
local EZTest_Main = CreateFrame("Frame","EZTest") |
Hello and welcome!
Could you wrap your code in the [ CODE ] or [ highlight="Lua"] tags? (The Buttons above your advanced editing text box.) This makes reading much easier. Also, I have not fully understood what your problem is. Where in your code is the positon that does not do what you want it to do? |
Hi Ludius, sorry first time user didnt know where to add the code blocks, since been fixed.
Heres what this code should do: 1) Load SavedVariables per charater 2) Update the config gui ( in interface>addons ) with the loaded data or set the 2 toggles to blank if no variables are found ( new toon etc ). This isnt updating. 3) On log out the SavedVariables per characted should update the addon.lua file in their respective folders ( not happening ). 4) The changes from the config gui should be accessable throughout the addon. In terms of where the issue is, i cannot pinpoint it exactly. The gui isnt updating, the changes to the options gui are not being saved. The variables from the gui are not accessable from outside the gui i.e 1) Option 1 is set to true ( from saved variables ) 2) Option 1 is changed to false from the options gui 3) Option 1 is accessable to other parts of the addon 4) on player logout Option 1 is saved as False in the saved variables 5) on log in Option is is set to False in the gui |
OK, can you share your toc file? If your SavedVariables are not working, we first have to make sure it is setup there correctly.
|
hey mate, the saved variables is working correctly as wiping the data.lua file from the realm>toon folder and logging in/out of a new toon builds a new data.lua file but it doesnt save any changes made from the gui.
Toc: Code:
## Interface: 90002 |
Have you checked if your setFuncs get executed as expected?
Lua Code:
PS: You also know that changes are only written back to the saved variable files once you /reload or exit the game, right? |
you have to define EZTestData first
|
Hey mate, yes was aware of the variables only being written to the .lua file on logout, unlike the SavedVariables which only get written on game exit.
I have put print statements inside the function block but they do not print any information out. Putting print statement outside the block works once when the addon loads but not if opened in game to change options. I have tried to see if that was a bug by placing the code inside the same function block inside another addon (Norgannas slidebar from the auctioneer pack). Same thing happens there, doesnt print inside the block. |
I'm not sure, if this works:
Lua Code:
Try this and put a print in there to see if anything is happening at all when you click the button: Lua Code:
|
Still nothing, and it turns out the addon I was using as a basis isnt working either. Might be that or the libD errors Im seeing in bugsack.
|
Of course, if there is an error anywhere in your lua file (red bugsack minimap icon) it's likely that nothing will work.
|
Might have to try the xml approach to frames.
|
Or you could figure out the cause of the error and remedy it?
|
All times are GMT -6. The time now is 11:37 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI