Thread Tools Display Modes
Prev Previous Post   Next Post Next
06/24/15, 02:33 PM   #1
Woeler
 
Woeler's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2014
Posts: 40
Save leaderboards in savedvariables, can't get it to work

I simply cannot get it to work. don't know why.

Lua Code:
  1. local _settings = {}
  2. local savedVariables
  3. local index = 1
  4. local i = 1
  5.  
  6.  
  7. local function GetRaidLeaderboardEntries(index)
  8.  
  9.  
  10.     local ranking, charName, score, classId, allianceId
  11.    
  12.     local entry
  13.    
  14.     for i = 1, GetNumRaidLeaderboardEntries(index) do
  15.    
  16.         ranking, charName, score, classId, allianceId = GetRaidLeaderboardEntryInfo(index, i)
  17.    
  18.         entry = {
  19.            
  20.             ranking == ranking,
  21.             charName == charName,
  22.             score == score,
  23.             classId == classId,
  24.             allianceId == allianceId
  25.        
  26.         }
  27.        
  28.         table.insert(savedVariables,entry)
  29.        
  30.     end
  31.  
  32. end
  33.  
  34. local function OnAddonLoaded(event, addonName)
  35.         if addonName == "webraid" then --addonName is in general name of your addon manifext without .txt extension
  36.  
  37.             savedVariables = ZO_SavedVars:NewAccountWide("webraid", 1, _settings, nil)
  38.      
  39.  
  40.         end
  41.     end
  42.  
  43. EVENT_MANAGER:RegisterForEvent("MyAddon_LeaderBoardDataChanged",EVENT_RAID_LEADERBOARD_DATA_CHANGED,function(eventCode)
  44.  
  45.     local leaderboards = GetNumRaidLeaderboards()
  46.  
  47.     savedVariables.leaderboards = leaderboards
  48.  
  49.     d("Leaderboard data saved...")
  50.  
  51. end)
  52.  
  53. EVENT_MANAGER:RegisterForEvent("MyAddon_Loaded",EVENT_ADD_ON_LOADED,function(eventCode,name)
  54.  
  55.      if name ~= "webraid" then return end
  56.  
  57.      SLASH_COMMANDS["/leaderboards"] = function()
  58.            d("Querying leaderboards...")
  59.            d(GetRaidLeaderboardEntryInfo(2, 1))
  60.            QueryRaidLeaderboardData()
  61.      end
  62.  
  63. end)

Saved variables just keeps doing weird stuff like this

Lua Code:
  1. webraid =
  2. {
  3.     ["Default"] =
  4.     {
  5.         ["@Woeler"] =
  6.         {
  7.             ["$AccountWide"] =
  8.             {
  9.                 ["version"] = 1,
  10.                 ["@Woeler"] =
  11.                 {
  12.                     ["$AccountWide"] =
  13.                     {
  14.                         ["@Woeler"] =
  15.                         {
  16.                             ["$AccountWide"] =
  17.                             {
  18.                                 ["version"] = 1,
  19.                             },
  20.                             ["Woeler"] =
  21.                             {
  22.                                 ["@Woeler"] =
  23.                                 {
  24.                                     ["Woeler"] =
  25.                                     {
  26.                                         ["@Woeler"] =
  27.                                         {
  28.                                             ["Woeler"] =
  29.                                             {
  30.                                                 ["version"] = 1,
  31.                                             },
  32.                                         },
  33.                                         ["version"] = 1,
  34.                                     },
  35.                                 },
  36.                                 ["version"] = 1,
  37.                             },
  38.                         },
  39.                         ["version"] = 1,
  40.                     },
  41.                     ["Woeler"] =
  42.                     {
  43.                         ["@Woeler"] =
  44.                         {
  45.                             ["Woeler"] =
  46.                             {
  47.                                 ["@Woeler"] =
  48.                                 {
  49.                                     ["Woeler"] =
  50.                                     {
  51.                                         ["version"] = 1,
  52.                                     },
  53.                                 },
  54.                                 ["version"] = 1,
  55.                             },
  56.                         },
  57.                         ["version"] = 1,
  58.                     },
  59.                 },
  60.                 ["entries"] =
  61.                 {
  62.                 },
  63.             },
  64.             ["Woeler"] =
  65.             {
  66.                 ["@Woeler"] =
  67.                 {
  68.                     ["Woeler"] =
  69.                     {
  70.                         ["@Woeler"] =
  71.                         {
  72.                             ["Woeler"] =
  73.                             {
  74.                                 ["version"] = 1,
  75.                             },
  76.                         },
  77.                         ["version"] = 1,
  78.                     },
  79.                 },
  80.                 ["version"] = 1,
  81.             },
  82.         },
  83.     },
  84. }
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » Save leaderboards in savedvariables, can't get it to work


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