Thread Tools Display Modes
08-22-11, 03:55 PM   #1
Tomine
A Fallenroot Satyr
 
Tomine's Avatar
AddOn Compiler - Click to view compilations
Join Date: May 2009
Posts: 21
Anchoring in LUA

I am trying to anchor an addon (stExperience) to my Player Frame. The default anchor was to the Minimap, but when I changed it to be attached to Player, it would not anchor. If I move my player frame, the experience bar I anchored to it does not move with it.

Am I doing something wrong...? The bar itself is fine and dandy, working as intended, but it does not seem to want to anchor to my Player frame: grrr. if anyone knows what I can do to fix this, please let me know!
  Reply With Quote
08-22-11, 04:06 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Are you anchoring it to a frame named Player or a frame named PlayerFrame?
__________________
"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
08-22-11, 04:09 PM   #3
Tomine
A Fallenroot Satyr
 
Tomine's Avatar
AddOn Compiler - Click to view compilations
Join Date: May 2009
Posts: 21
Originally Posted by Seerah View Post
Are you anchoring it to a frame named Player or a frame named PlayerFrame?
If I anchor it to PlayerFrame, the experience bar disappears altogether. If I change it to Player, it reappears.

I originally thought it had to be PlayerFrame, but the addon went POOF when I typed PlayerFrame. Thus why I am so very confused. : ( I have the Y and X both at 0.
  Reply With Quote
08-22-11, 04:15 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Well, what is the frame's actual name? Type /framestack and hover over to see. If you are using the default Blizz UFs, then I'm fairly certain that it's named PlayerFrame. If your x and y are set to 0, then the experience bar would be centered at the player frame. Note, if you have its strata or level lower than the unit frame, then it will be behind it.
__________________
"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
08-22-11, 04:26 PM   #5
Tomine
A Fallenroot Satyr
 
Tomine's Avatar
AddOn Compiler - Click to view compilations
Join Date: May 2009
Posts: 21
Ah! It worked when I attached it to Stuf.units.player... now I feel silly.. Thank you very much for taking the time to help me. I was so lost with myself. : )
  Reply With Quote
08-22-11, 04:28 PM   #6
Tomine
A Fallenroot Satyr
 
Tomine's Avatar
AddOn Compiler - Click to view compilations
Join Date: May 2009
Posts: 21
Originally Posted by Tomine View Post
Ah! It worked when I attached it to Stuf.units.player... now I feel silly.. Thank you very much for taking the time to help me. I was so lost with myself. : )
Actually, scratch that.. it is not anchored to it. x___x The experience bar will not move with the player frame when I change its position. Back to the drawing board...
  Reply With Quote
08-22-11, 04:45 PM   #7
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Can you show us the code you're using?

It's also possible that you need to 'delay' your code until Stuf has actually created the player frame, using an OnEvent function. Preferably, wait until VARIABLES_LOADED has fired. Something like this:

Code:
local f = CreateFrame("Frame")
f:RegisterEvent("VARIABLES_LOADED")
f:SetScript("OnEvent", function()
--your code goes here
end)
  Reply With Quote
08-22-11, 05:00 PM   #8
Tomine
A Fallenroot Satyr
 
Tomine's Avatar
AddOn Compiler - Click to view compilations
Join Date: May 2009
Posts: 21
This is the line I am trying to edit:

--------AnchorPoint, AnchorTo, RelativePoint, xOffset, yOffset
local Anchor = { "TOP", Stuf.units.player, "BOTTOM", 1, 191 }
  Reply With Quote
08-22-11, 08:44 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Yes, but that doesn't tell us *when* you're trying to do this.
__________________
"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

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Anchoring in LUA


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