WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Warforged Seals (https://www.wowinterface.com/forums/showthread.php?t=49465)

mec666 07-14-14 10:37 AM

Warforged Seals
 
i'm writing an ldb plugin so i can see warforged seals. but what is the name the icon i use for it? is there somewhere i can find this? right now its a blank box.

i'm new to writing addons/plugs so not sure what we have available for finding this information.

Lombra 07-14-14 11:02 AM

Think you can use this with the appropriate currency ID:
Code:

local name, amount, texturePath, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo(id)

mec666 07-14-14 11:44 AM

this is what I have so far. it worked for timeless coins. so not sure why it wouldn't work for warforged.

Lua Code:
  1. local WarforgedSeal = CreateFrame("Frame", "MEC_Warforged_Seal")
  2. WarforgedSeals.obj = LibStub("LibDataBroker-1.1"):NewDataObject("MEC Warforged Seals",{
  3.     type  = "data source",
  4.     text  = "0",
  5.     label = "Warforged Seal",
  6.     icon  = "Interface\\Icons\\inv_arcane_orb",
  7. } )
  8.  
  9. WarforgedSeal:SetScript("OnEvent", function()
  10.     for i = 1, GetCurrencyListSize(), 1 do
  11.         local _, _, _, _, _, _, icon, _, _, _, _ = GetCurrencyListInfo(i)
  12.         if icon == "Interface\\Icons\\inv_arcane_orb" then
  13.             local _, _, _, _, _, count, _, _, _, _, _ = GetCurrencyListInfo(i)
  14.             Warforgedseal.obj.text = count or "0"
  15.         end
  16.     end
  17. end)
  18.  
  19. WarforgedSeal:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
  20. WarforgedSeal:RegisterEvent("PLAYER_ENTERING_WORLD")

semlar 07-14-14 11:55 AM

You should only need something like this..
Lua Code:
  1. WarforgedSeal:SetScript("OnEvent", function(self)
  2.     local name, count, texture = GetCurrencyInfo(776)
  3.     self.obj.text = count or "0"
  4. end)
You can get the currency id from the wowhead url for it, timeless coins are 777.

Also you have a typo (presumably) with "WarforgedSeals.obj", the S on the end should likely not be there.

mec666 07-14-14 12:15 PM

so just something like this then?

Lua Code:
  1. local WarforgedSeal = CreateFrame("Frame", "MEC_Warforged_Seal")
  2. WarforgedSeals.obj = LibStub("LibDataBroker-1.1"):NewDataObject("MEC Warforged Seals",{
  3.     type  = "data source",
  4.     text  = "0",
  5.     label = "Warforged Seal",
  6.     icon  = "Interface\\Icons\\inv_arcane_orb",
  7. } )
  8.  
  9. WarforgedSeal:SetScript("OnEvent", function()
  10.  
  11.     local name, count, texture = GetCurrencyInfo(776)
  12.  
  13.     Warforgedseal.obj.text = count or "0"
  14.  
  15. end)
  16.  
  17. WarforgedSeal:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
  18. WarforgedSeal:RegisterEvent("PLAYER_ENTERING_WORLD")

I tried this and it still shows 0. unless i'm still doing something wrong

Lombra 07-14-14 12:19 PM

You should really enable Lua errors, or install an addon that lets you see them. You first have 'WarforgedSeal', then you set 'WarforgedSeals.obj' with an extra 's', as I believe semlar pointed out. Finally you use 'Warforgedseal.obj.text' with a lower case 's'. These all need to be the same. (Lua is case sensitive)

semlar 07-14-14 12:23 PM

Yeah, all of those problems would throw errors so it should be fairly obvious when you try to run it. Errors can be enabled under Interface > Help in-game.

My bad for not actually reading the parts that I copied.

mec666 07-14-14 01:07 PM

wow. that was the main part of the problem. thank you that works now.

still don't understand why my code works for timeless coins but not the rest.

but your code does work for the lesser charms and warforged.

thank you for your help. now I just gotta fix the problems with docking station. unless you know of a better ldb viewer. cuz this one isn't working so well. I gotta move it everytime I login. but that's something I can take up with the developer of it.

Phanx 07-14-14 01:41 PM

I switched to Bazooka several years ago and haven't had any problems with it. I've also had several users of my LDB plugins report problems with Docking Station not supporting some LDB properties correctly or at all, so you're not alone.

On a mostly-unrelated note, please don't put prefixes like "MEC" in front of your addon names where they're going to be displayed in alphabetical lists, such as TOC Title fields and LDB object names. If your addon is called "Warforged Seals" then users will expect to find it in the "W" section of these lists, not the "M" section. Likewise, if you are using color codes in your TOC title, that also screws up alphabetizing, and makes the addon list look like a clown's makeup tray, so don't do it. If you really feel the need to stick your name/initials/whatever in the title, put them at the end so users don't have to read every single item in the list when looking for your addon. :(

mec666 07-14-14 02:42 PM

will do. these are the first ones I've done. and I did that just so I could find them. but yeah i'll change that before I release it. I wanna make it stable first. but I think i'm going to change from docking station. I just can't get it to work right at all.


All times are GMT -6. The time now is 08:44 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI