Quantcast
WoWInterface - View Single Post - Clear Button Texture and Text LUA Help
View Single Post
04-24-17, 07:31 PM   #4
Dejablue
A Wyrmkin Dreamwalker
 
Dejablue's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 55
Originally Posted by syncrow View Post
You're code re-creates your buttons constantly, which would cause massive error junk when you loot beacons right in combat....

It would be much better to pre-create all necessary buttons and only handle the count text upon bag updates.

Here is a little example on how it would look like:
Lua Code:
  1. local buttonSize = 36
  2. local padding = 0;
  3. local beacons = {
  4.     -- rares
  5.     [146923] = ""-- petrification
  6.     [147355] = ""-- bloodstrike
  7.     [146922] = ""-- fel growth
  8.     [146915] = ""-- greater Torment
  9.     [146912] = ""-- greater carnage
  10.     [146914] = ""-- greater engineering
  11.     [146910] = ""-- greater dominance
  12.     [146913] = ""-- greater warbeasts
  13.     [146911] = "",  -- greater firestorm
  14.    
  15.     -- uncommons
  16.     [146906] = "",  -- carnage
  17.     [146907] = "",  -- warbeasts
  18.     [146909] = "",  -- torment
  19.     [146908] = "",  -- engineering
  20.     [146903] = "",  -- dominance
  21.     [146905] = ""-- firestorm
  22. }
  23.  
  24. .....
  25.            
  26.         ....

The buttons in this example are static and do not hide / show themselves properly, but this is further secure wrapping....

PS: beacons are not stackable, as far as i'm aware
My first inclination was to create a table listing them all, but I chose to try this method as a sort of exercise as well as wanting to create them dynamically as found in the bags without knowing their specific names. This would future proof it if Blizzard decided to make a beacon of Murlocs, for example. There are also epic boss ones and epic ones that you take to each broken shore game

This isn't the entire code. I am not trying to show or hide them in combat, there is an inCombat check for a button that shows or hides them all that does nothing in combat.

They do indeed stack. to 20 as per itemStackCount = GetItemInfo()

Thank you for taking the time. I appreciate it very much. Let me know if you have any ideas about creating them as a loop. Gah I really don;t want to make static tables for this ;/
  Reply With Quote