Yes the first part sets the panel up as part of the settings system - you just need to add your controls to it as you did.
The second part, will open to your addon page ( all going well - it did for me ). All you have to do now is make sure your addon does the rest of the stuff you wanted it to, and if you were saving stuff for future play sessions, you need to use the saved variables table to store it. |
Look at what I changed in the files, they were copies of what you posted. So, you should see what I changed and why I changed it because of the notes I put in there.
If it doesn't work after you have added what you think is all that needs to be added, check again in case you missed something. Even doing something in the wrong order can affect the output. Names of frames and tables can affect things as well. I have set the files up so that they are separate files talking to each other. You can add another file that does the main stuff in the addon and have the settings panel talk to it. For example: QuestCompletionFrame.lua SettingsPanel.lua MinimapButton.lua QuestCompletionFrame.lua could hold all your quest completion code and not talk to the settings or the minimap button. SettingsPanel needs to know about the QuestCompletionFrame as you have it showing and hiding the frame when the check boxes are clicked. MinimapButton.lua needs to know about the SettingsPanel to open it up and show the controls. Now, the question is, if you were going to use the SavedVariablesTable for session to session access to the settings. Then you can either have that set up in its own file and loaded before QuestCompletionFrame or you can have QuestCompletionFrame set those variables up, the game handles loading and saving them when you log in and out. All you have to do is make sure that it exists. For example: If you had a SavedVariablesTable called .. ZTVCurrentSettings then you would do this to initialise it, ready for use. ZTVCurrentSettings = ZTVCurrentSettings or {} This makes sure that any existing values are kept, or it creates a new table because there are no existing values. You can use this at the top of the file that first needs access to it. In either case it needs to be sorted out before you get and set them in SettingsPanel or use them in QuestCompletionFrame. Like I said, order is everything. |
As I understand it, the line in the "AddonName.tok." file is responsible for saving the position of the "icon on the minimap".
Lua Code:
Lua Code:
Then why doesn’t my “minimap icon” save its position after exiting the game? |
That I don't know as I never really used the minimap icon.
bugsack uses it but it doesn't save anything to it apart from whether it shows it on the minimap or not. Okay, looking at a few query posts about the icon .. and a look in the libdbicon source file itself I can see that they have set aside a table of values for saving the minimap values if the minimap icon addon chooses to do so. Lua Code:
Now looking at Lua Code:
Lua Code:
Would be the better set up allowing your addon to have other settings for the rest of the addon and the minimapIcon section for the minimap icon part. In theory the libdbicon stuff should handle the saving of it, as long as you set it up. So, lets give that a whirl on my test example I made before to see if my theory works out. |
Well my test addon doesn't save it .. but, testing bugsack and it does. So something in its code must be saving it in some form.
edit: Okay figured it out .. Files Changed: TestAddonSettings.toc File changed to have 2 saved variable tables, one for the addon data and one for the minimap icon data Lua Code:
MinimapButton.lua -- Redesigned file to match bugsacks segmented approach ( in case that was the solution ). It looks tidier though so kept it -- Made sure Saved Variable tables were initialised with default values -- MinimapButton's saved variable data was put in its own table, not a sub table same as bugsack -- The MinimapButton was also initialised on player login - of course this would be when the saved variables would have been loaded up - this might have been all we needed to do. Lua Code:
Anyway, after these changes, the minimap button now retains its location successfully. |
Thank you very much, you helped me a lot. This is a great forum and I will recommend it to everyone.
|
All times are GMT -6. The time now is 12:33 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI