Reply
 
Thread Tools Display Modes
Unread 01-01-13, 10:14 PM   #1
10leej
A Firelord
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 487
focustarget targetting event (solved)

So trying to add the !beautycase border to the focus target frame and I figured

"Well if I just run FocusFrameToTPortraitModel:CreateBorder(8,1,1,1) all I'm gonna get is

"Message: Interface\AddOns\BobUI\modules\unitframes.lua:647: attempt to index global 'FocusFrameToTPortraitModel' (a nil value)"

So I should probably make a script looking like this

Lua Code:
  1. local w = CreateFrame("Frame")
  2. w:RegisterEvent("PLAYER_FOCUS_CHANGED")
  3. function w:OnEvent(event, ...)
  4.   event == "PLAYER_FOCUS_CHANGED" then
  5.   FocusFrameToTPortraitModel:CreateBorder(8,1,1,1)
  6. end
  7. w:SetScript("OnEvent", w.OnEvent)

So add that stuff to my addon (whoa unitframes btw) and low and behold I still get

"Message: Interface\AddOns\BobUI\modules\unitframes.lua:647: attempt to index global 'FocusFrameToTPortraitModel' (a nil value)"

when I add a focus something for the first time, but anytime after I do that it works perfectly

So i figured "I must be using the wrong event"

but alas "PLAYER_FOCUS_CHANGED" the only event I found pertaining to the focus target

and now I'm all like "I need more helpz" so i dialed my buddies here at wowinterface and made a thread

FocusFrameToTPortraitModel is the frame created by adapt for the 3d portraits.

Last edited by 10leej : 01-02-13 at 12:36 AM. Reason: issue solved
10leej is offline   Reply With Quote
Unread 01-01-13, 10:29 PM   #2
semlar
A Molten Giant
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 636
Why don't you just modify Adapt to add the border if it's creating the frame?

I guess you could do something like wait for ADDON_LOADED and watch for Adapt, then call

Lua Code:
  1. hooksecurefunc(Adapt, 'CreateModel', function(texture)
  2.   if texture:GetName() ~= "FocusFrameToTPortrait" then return end
  3.   -- do stuff
  4. end)

Last edited by semlar : 01-01-13 at 10:41 PM.
semlar is online now   Reply With Quote
Unread 01-01-13, 10:44 PM   #3
10leej
A Firelord
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 487
Originally Posted by semlar View Post
Why don't you just modify Adapt to add the border if it's creating the frame?

I guess you could do something like wait for ADDON_LOADED and watch for Adapt, then call

Lua Code:
  1. hooksecurefunc(Adapt, 'CreateModel', function(texture)
  2.   if texture:GetName() ~= "FocusFrameToTPortrait" then return end
  3.   -- do stuff
  4. end)
Cause I'd have to reapply the changes if Gello was to change it
10leej is offline   Reply With Quote
Unread 01-02-13, 06:08 AM   #4
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 103
Originally Posted by 10leej View Post
Cause I'd have to reapply the changes if Gello was to change it
Then simply add the EventRegister into the hookfunc.

Lua Code:
  1. local w = CreateFrame("Frame")
  2. function w:OnEvent(event, ...)
  3.  
  4.   event == "PLAYER_FOCUS_CHANGED" then
  5.  
  6.   FocusFrameToTPortraitModel:CreateBorder(8,1,1,1)
  7.  
  8. end
  9. w:SetScript("OnEvent", w.OnEvent)
  10.  
  11. hooksecurefunc(Adapt, 'CreateModel', function(texture)
  12.  
  13.   if texture:GetName() ~= "FocusFrameToTPortrait" then return end
  14.  
  15.   FocusFrameToTPortraitModel:CreateBorder(8,1,1,1)
  16.  
  17.   w:RegisterEvent("PLAYER_FOCUS_CHANGED")
  18.  
  19. end)
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker

Last edited by humfras : 01-02-13 at 06:12 AM.
humfras is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Lua/XML Help » focustarget targetting event

Thread Tools
Display Modes

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