Thread Tools Display Modes
11-15-09, 04:25 PM   #1
Drshow
A Cyclonian
 
Drshow's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 49
Lightbulb Saving Achievement List with ID's to Variable

i am just trying to parse a search string and save the results to a variable. Anyone proof read my code n correct me, please lol.
variable name = AchievID
so far it just saves x,n not the actual search results.
Code:
local max,search=5000,"gold"; 
 for x=1,max do 
  local _,n = GetAchievementInfo(x) 
   if n then 
    if string.find(n,search) then 
    print(x,n) 
    AchievID = ("x,n") 
    end 
   end 
end
__________________
  Reply With Quote
11-15-09, 08:56 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
I'm assuming you want to save the search results to the AchievID variable?

Right now, the variable is just "x,n" because you're assigning the string "x,n" to that variable.

AchievID = ("x,n")

should be

AchievID = (x..","..n)

This will save the value of x and the value of n separated by a comma. The two dots (..) concatenate everything together.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-16-09, 08:31 PM   #3
Drshow
A Cyclonian
 
Drshow's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 49
Originally Posted by Seerah View Post
I'm assuming you want to save the search results to the AchievID variable?

Right now, the variable is just "x,n" because you're assigning the string "x,n" to that variable.

AchievID = ("x,n")

should be

AchievID = (x..","..n)

This will save the value of x and the value of n separated by a comma. The two dots (..) concatenate everything together.
OMG Seerah, i just had a duh moment lol. TY so much. I was actually way off on how to parse that table with as little code as possible.

I spent all night trolling on Curse with another trying to get this to work, but what we did was
Code:
local AchievementLister = {}
AchievID = {} -- account variables
AchievementLister.frame = CreateFrame("Frame", nil, UIParent)
SLASH_ACHIEVEMENTLISTER1 = "/alister"
SLASH_ACHIEVEMENTLISTER2 = "/achievementlister"
SlashCmdList[ "ACHIEVEMENTLISTER" ] = function() AchievementLister:runSlash() end
function AchievementLister:runSlash()
   local max = 5000
   local count = 1
   for x=1,max do
      local _,name = GetAchievementInfo(x)
      if name then
         AchievID[ count ] = x .. " - " .. name
         count=count+1
      end
   end
end
nothing fancy it got the job done. It parsed in count all Achievements that have a space character in its string. Then saved count to a variable. I posted the full list on curseforge and am trying to make a few minutes to post here too, served myself as a good reference.

http://forums.curseforge.com/showthread.php?t=17344

the list is on WoWwiki @ http://www.wowwiki.com/Complete_list...evement_ID%27s search page in IE works great.
__________________

Last edited by Drshow : 11-18-09 at 02:28 AM. Reason: added wowwiki list, url moved for wiki, updated
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Saving Achievement List with ID's to Variable


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