View Single Post
12-29-17, 08:25 PM   #18
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Originally Posted by Fizzlemizz View Post
I'm not sure what you are trying to achieve or may have planned to-do so much of my thinking is just a "stab in the dark".

Consider, you login one day with 24 addons, you exit. The next day you decide you only need 17 of them. Keeping the SavedVariable information from the previous day intact means that slots 18-24 will contain stale and possibly duplicate (possibly incorrect) information as they won't be overwritten using the new list of only 17 addons. Wiping the table each time means you have current data.

With the code you've given,
Code:
local addonlistdb
...
addonlistdb = AddonListDB
so far is not needed as you have been writing directly to AddonListDB (addonlistdb is just a pointer to AddonListDB, not a copy of the table)
Code:
AddonListDB = AddonListDB or {}
is all you need if you want to preserve the data between sessions.
/facepalm

I forgot the golden rule when asking for help, tell them what you are trying to do. So, my grand idea is thr following:

1. Get list of all addons at PLAYER_LOGOUT (I liked your suggestion).
2. Next time you logout of the game, compare your current addon state (enabled or disabled) to the old list.
3. Update the date/time stamp (see code below, minor modification) if the current addon state is different from the old data.
4. NOT IMPLEMENTD YET: At defined intervals, remind player that an addon has not been used for x period of time, say 30 days.
5. This helps the player decide if they still want the addon installed.

Why? I frequently install and addon and eventually stop using it, I'd like a reminder to uninstall it due to lack of use.

Lua Code:
  1. AddonListDB[i] = {
  2.                 Title=title,
  3.                 Loaded=loaded or false,
  4.                 DateTime=date("%m/%d/%y %H:%M:%S")
  5.             };

Lua Code:
  1. AddonListDB = {
  2.     {
  3.         ["Loaded"] = false,
  4.         ["Title"] = "!!!Ease Addon Controller",
  5.         ["DateTime"] = "12/29/17 00:26:23",
  6.     }, -- [1]

I need to work up the compare logic and then later the reminder mechanism. Is this a good approach to what I am trying to accomplish? Maybe there are better ways to do this.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote