View Single Post
08-19-15, 02:17 PM   #5
evilbib
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 30
Originally Posted by Phanx View Post
Well, then this is where posting fake code examples gets you in trouble... if the actual code is set up like your example (local "frame" with no name, parent, or distinguishing features created inside a local function) then no, there's no way to access it from another file in another addon. However, it seems unlikely that a real addon would actually do that, so there's probably a way... but without seeing the actual code, there's no way to tell.
Actually the addon (teksLoot) returns this frame, this is the whole function:
Lua Code:
  1. local function CreateRollFrame()
  2.     local frame = CreateFrame("Frame", nil, UIParent)
  3.     frame:SetWidth(328)
  4.     frame:SetHeight(26)
  5.     frame:SetBackdrop(backdrop)
  6.     frame:SetBackdropColor(0, 0, 0, .9)
  7.     frame:SetScript("OnEvent", OnEvent)
  8.     frame:RegisterEvent("CANCEL_LOOT_ROLL")
  9.     frame:CreateBeautyBorder(11)
  10.     frame:SetBeautyBorderPadding(-1)
  11.     frame:Hide()
  12.  
  13.     local button = CreateFrame("Button", nil, frame)
  14.     button:SetPoint("LEFT", 0, 0)
  15.     button:SetWidth(28)
  16.     button:SetHeight(28)
  17.     --button:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
  18.     button:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
  19.     button:GetHighlightTexture():SetBlendMode("ADD")
  20.     button:SetScript("OnEnter", SetItemTip)
  21.     button:SetScript("OnLeave", HideTip2)
  22.     button:SetScript("OnUpdate", ItemOnUpdate)
  23.     button:SetScript("OnClick", LootClick)
  24.     frame.button = button
  25.  
  26.     local buttonborder = CreateFrame("Frame", nil, button)
  27.     buttonborder:SetWidth(32)
  28.     buttonborder:SetHeight(32)
  29.     buttonborder:SetPoint("CENTER", button, "CENTER")
  30.     buttonborder:SetBackdrop(backdrop)
  31.     buttonborder:SetBackdropColor(1, 1, 1, 0)
  32.     buttonborder:CreateBeautyBorder(11)
  33.     buttonborder:SetBeautyBorderPadding(-1)
  34.     frame.buttonborder = buttonborder
  35.  
  36.     local tfade = frame:CreateTexture(nil, "BORDER")
  37.     tfade:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -4)
  38.     tfade:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 4)
  39.     tfade:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
  40.     tfade:SetBlendMode("ADD")
  41.     tfade:SetGradientAlpha("VERTICAL", .1, .1, .1, 0, .25, .25, .25, 1)
  42.  
  43.     local status = CreateFrame("StatusBar", nil, frame)
  44.     status:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -4, -4)
  45.     status:SetPoint("BOTTOM", frame, "BOTTOM", 0, 4)
  46.     status:SetPoint("LEFT", frame.button, "RIGHT", -1, 0)
  47.     status:SetScript("OnUpdate", StatusUpdate)
  48.     status:SetFrameLevel(status:GetFrameLevel()-1)
  49.     status:SetStatusBarTexture("Interface\\AddOns\\teksLoot\\media\\statusbar.tga")
  50.     status:SetStatusBarColor(.8, .8, .8, .9)
  51.     status.parent = frame
  52.     frame.status = status
  53.  
  54.     local spark = frame:CreateTexture(nil, "OVERLAY")
  55.     spark:SetWidth(14)
  56.     spark:SetHeight(35)
  57.     spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
  58.     spark:SetBlendMode("ADD")
  59.     status.spark = spark
  60.  
  61.     local need, needtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Dice-Up", "Interface\\Buttons\\UI-GroupLoot-Dice-Highlight", "Interface\\Buttons\\UI-GroupLoot-Dice-Down", 1, NEED, "LEFT", frame.button, "RIGHT", 5, -1)
  62.     local greed, greedtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Coin-Up", "Interface\\Buttons\\UI-GroupLoot-Coin-Highlight", "Interface\\Buttons\\UI-GroupLoot-Coin-Down", 2, GREED, "LEFT", need, "RIGHT", 0, -1)
  63.     local de, detext
  64.     de, detext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-DE-Up", "Interface\\Buttons\\UI-GroupLoot-DE-Highlight", "Interface\\Buttons\\UI-GroupLoot-DE-Down", 3, ROLL_DISENCHANT, "LEFT", greed, "RIGHT", 0, -1)
  65.     local pass, passtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Pass-Up", nil, "Interface\\Buttons\\UI-GroupLoot-Pass-Down", 0, PASS, "LEFT", de or greed, "RIGHT", 0, 2.2)
  66.     frame.needbutt, frame.greedbutt, frame.disenchantbutt = need, greed, de
  67.     frame.need, frame.greed, frame.pass, frame.disenchant = needtext, greedtext, passtext, detext
  68.  
  69.     local bind = frame:CreateFontString()
  70.     bind:SetPoint("LEFT", pass, "RIGHT", 3, 1)
  71.     bind:SetFont("Fonts\\FRIZQT__.TTF", 13, "OUTLINE")
  72.     frame.fsbind = bind
  73.  
  74.     local loot = frame:CreateFontString(nil, "ARTWORK", "SystemFont_Outline")
  75.     loot:SetPoint("LEFT", bind, "RIGHT", 0, .12)
  76.     loot:SetPoint("RIGHT", frame, "RIGHT", -5, 0)
  77.     loot:SetHeight(16)
  78.     loot:SetJustifyH("LEFT")
  79.     frame.fsloot = loot
  80.  
  81.     frame.rolls = {}
  82.  
  83.     return frame
  84. end
  Reply With Quote