WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF - Layout discussion (https://www.wowinterface.com/forums/showthread.php?t=18363)

zhr 10-04-08 02:41 AM

i have a trouble with target names, they run on target hp http://img139.imageshack.us/my.php?image=lolnv5.jpg
how it to correct?
P.S. sorry for my english (:

haste 10-04-08 04:30 AM

Caellian, you really need to stop using that edit button :p. Especially when you add ten pages of text (and that 3 hours after it's been posted).

1) "Interface\AddOns\oUF_Caellian\oUF_Caellian.lua:56: attempt to index local 'parent' (a nil value)" tells you that you should take a look at line 56 in your layout code.

2) :GetText() returns a string containing the text of the fontstring, it won't do some magic updating for you. What you could do is to remove .Name, and use the castbar .Text to display name. You can do this with a post hook in the stop functions. Remember that you will have to do all the name updating yourself, and that is has to be aware of casts/channels.

vaddn, use locals and not globals when you create those frames. The initial code should work fine with that.

zhz, it's because your fontstrings have no width limitations. You can set these with :SetWidth and/or :SetPoint.

zynix, read up on :SetPoint, and look for it in the layout. Usually placed at the bottom.

vadda 10-04-08 05:43 AM

Quote:

Originally Posted by haste (Post 103448)
vaddn, use locals and not globals when you create those frames. The initial code should work fine with that.

Works like a charm...thx...made my day

Frayol 10-05-08 03:22 AM

Quote:

Originally Posted by MoonWitch (Post 103205)
Thanks :) I'll do that. I still get freaked out when I see the pvp icon, so I figured it'd be better for my heart to use text. :P

Did you get this to work? I'd be really interested to see the code you used if you did as it is something that I'd like to add as well. I too would prefer to see a text tag rather than the icon... for some reason the icon doesn't always register in my brain whereas text does. :o

On another note, is it possible to add the AFK and DND flags with oUF? I've tried looking, but haven't managed to find an answer yet. The only reason I ask is that I have a bad habit of setting flags and forgetting about them if there is nothing to remind me on my character frame.

p3lim 10-05-08 04:42 AM

Quote:

Originally Posted by Frayol (Post 103486)
Did you get this to work? I'd be really interested to see the code you used if you did as it is something that I'd like to add as well. I too would prefer to see a text tag rather than the icon... for some reason the icon doesn't always register in my brain whereas text does. :o

On another note, is it possible to add the AFK and DND flags with oUF? I've tried looking, but haven't managed to find an answer yet. The only reason I ask is that I have a bad habit of setting flags and forgetting about them if there is nothing to remind me on my character frame.

You can easily do this with custom tags, but it doesnt really have anything to do with unitframes, so thats the reason haste havent implemented it.

Slakah 10-05-08 06:33 AM

Quote:

On another note, is it possible to add the AFK and DND flags with oUF? I've tried looking, but haven't managed to find an answer yet. The only reason I ask is that I have a bad habit of setting flags and forgetting about them if there is nothing to remind me on my character frame.
You could add some custom tags:

Code:

oUF.Tags["[AFK]"] = function(u) return UnitIsAFK(u) and "AFK" or ""
oUF.Tags["[DND]"] = function(u) return UnitIsDND(u) and "DND" or ""

oUF.TagEvents["[AFK]"] = "UNIT_FLAGS"
oUF.TagEvents["[DND]"] = "UNIT_FLAGS"

(note: I'm not certain if the event is correct as I don't have access to WoW currently.)

and then use those tags as you would normally.

p3lim 10-05-08 06:44 AM

Quote:

Originally Posted by Slakah (Post 103496)
You could add some custom tags:

Code:

oUF.Tags["[AFK]"] = function(u) return UnitIsAFK(u) and "AFK" or ""
oUF.Tags["[DND]"] = function(u) return UnitIsDND(u) and "DND" or ""

oUF.TagEvents["[AFK]"] = "UNIT_FLAGS"
oUF.TagEvents["[DND]"] = "UNIT_FLAGS"

(note: I'm not certain if the event is correct as I don't have access to WoW currently.)

and then use those tags as you would normally.

PLAYER_FLAGS_CHANGED is the event

(dont be fooled by the name of the event, it works for any unit)

Caellian 10-05-08 08:18 AM

One question, i would like to have my experience bar to show but only when i mouseover it.

I've tried something like the code below but obviously it doesn't work, i know it's wrong but that's all i could come up with using wowwiki and unfortunately i couldn't find any better information on how to do this.


Code:

local OnEnter = function(self)
 self.Experience_OnEnter(self)
 self.Experience:Show()
end

local OnLeave = function(self)
 self.Experience_OnLeave(self)
 self.Experience:Hide()
end


haste 10-05-08 08:35 AM

Quote:

Originally Posted by Caellian (Post 103504)
One question, i would like to have my experience bar to show but only when i mouseover it.
end[/code]

I don't know the code for your .Experience, so I'm just assuming it's a frame. The following will make it appear/disappear when you hover it:
Code:

self.Experience:SetScript('OnEnter', function(self) self:SetAlpha(1) end)
self.Experience:SetScript('OnLeave', function(self) self:SetAlpha(0) end)

You will have to use the OnEnter/OnLeave handler on the frame if you want it to show/hide when you enter the unit frame as a whole however. The above will only work for when you hover the position for the actual frame. You should also use :Hide/:Show in that case, and not :SetAlpha.

Caellian 10-05-08 08:40 AM

Thanks a lot i will give it a try, it's a statusbar btw. (here's the main part of it)

Code:

                if(IsAddOnLoaded('oUF_Experience')) then
                        self.Experience = CreateFrame('StatusBar', nil, self)
                        self.Experience:SetPoint('TOPLEFT', self.Power, 'BOTTOMLEFT', 0, -2.5)
                        self.Experience:SetPoint('BOTTOMRIGHT', self.Power, 'BOTTOMRIGHT', 0, -7.5)
                        self.Experience:SetStatusBarTexture(texturebar)
                        self.Experience:SetBackdrop({bgFile = 'Interface\\Tooltips\\UI-Tooltip-Background', insets = {top = -1, left = -1, bottom = -1, right = -1}})
                        self.Experience:SetBackdropColor(.15,.15,.15)
                        self.Experience.Tooltip = true


p3lim 10-05-08 08:40 AM

Quote:

Originally Posted by Caellian (Post 103508)
Thanks a lot i will give it a try, it's a statusbar btw.

Thats a frame

Caellian 10-05-08 09:39 AM

Quote:

Originally Posted by p3lim (Post 103509)
Thats a frame

Yes sry, but that didn't do anything, i've added this to the experience block, tried with both alpha-show/hide.

Slakah 10-05-08 10:14 AM

You'll need to set the alpha to 0 when it's loaded as well, or else it will be shown until moused over.

soo:

Code:

self.Experience:SetScript('OnEnter', function(self) self:SetAlpha(1) end)
self.Experience:SetScript('OnLeave', function(self) self:SetAlpha(0) end)
self.Experience:SetAlpha(0)


Caellian 10-05-08 10:22 AM

...I am not editing, i am not editing, i am not editing...

Nvm the above, actually i didn't even need to use that, i just edited my current OnEnter/OnLeave, thanks for the hints.

Code:

        self:SetScript("OnEnter", function(self)
                if(unit == 'player') then self.Experience:Show() end
                UnitFrame_OnEnter(self)
        end)

        self:SetScript("OnLeave", function(self)
                if(unit == 'player') then self.Experience:Hide() end
                UnitFrame_OnLeave(self)
        end)

Quote:

Originally Posted by Slakah (Post 103513)
You'll need to set the alpha to 0 when it's loaded as well, or else it will be shown until moused over.

I've added self.Experience:Hide() to the exp block but it still is shown on login though.

Slakah 10-05-08 10:46 AM

Quote:

I've added self.Experience:Hide() to the exp block but it still is shown on login though.
Line 72 of oUF_Experience bar:Show().

So you'll need to force it to hide when shown i.e.

Code:

local function Hide(f)
  f:Hide()
  f:SetScript("OnShow", f.Hide)
end
local function Show(f)
        f:Show()
        f:SetScript("OnShow", nil)
end

Hide(self.Experience)

self:SetScript("OnEnter", function(self)
        if(unit == 'player') then Show(self.Experience) end
        UnitFrame_OnEnter(self)
end)
self:SetScript("OnLeave", function(self)
        if(unit == 'player') then Hide(self.Experience) end
        UnitFrame_OnLeave(self)
end)


Caellian 10-05-08 02:30 PM

Hmm this doesn't work at all

Code:

local function Hide(f)
  f:Hide()
  f:SetScript("OnShow", f.Hide)
end
local Show(f)
        f:Show() -- LINE 280
        f:SetScript("OnShow", nil)
end

Hide(self.Experience)

Code:

Interface\AddOns\oUF_Caellian\oUF_Caellian.lua:280: syntax error near 'f'
Count: 1


p3lim 10-05-08 02:34 PM

Quote:

Originally Posted by Caellian (Post 103524)
Hmm this doesn't work at all

Code:

local function Hide(f)
  f:Hide()
  f:SetScript("OnShow", f.Hide)
end
local Show(f)
        f:Show() -- LINE 280
        f:SetScript("OnShow", nil)
end

Hide(self.Experience)

Code:

Interface\AddOns\oUF_Caellian\oUF_Caellian.lua:280: syntax error near 'f'
Count: 1


Code:

local function Hide(f)
  f:Hide()
  f:SetScript("OnShow", function() f.Hide end)
end
local Show(f)
        f:Show() -- LINE 280
        f:SetScript("OnShow", nil)
end

Hide(self.Experience)


Slakah 10-05-08 02:36 PM

Quote:

Originally Posted by Caellian (Post 103524)
Hmm this doesn't work at all


I forgot the "function" bit, amoung other things :P.

Post edited so it'll work now.

Caellian 10-05-08 03:33 PM

Yes yes now it works, it's hidden on login, but it won't show up anymore :D

Caellian 10-05-08 04:02 PM

This is what i've got, hidden on login, but doesn't show up on mouseover.

Beginning of the style (where the OnEnter/OnLeave were)

Code:

        local function Hide(f)
                f:Hide()
                f:SetScript("OnShow", f.Hide)
        end

        local function Show(f)
                f:Show()
                f:SetScript("OnShow", nil)
        end

        self:SetScript("OnEnter", function(self)
                if(unit == 'player') then Show(self.Experience) end
                UnitFrame_OnEnter(self)
        end)

        self:SetScript("OnLeave", function(self)
                if(unit == 'player') then Hide(self.Experience) end
                UnitFrame_OnLeave(self)
        end)

And at the end of the self.Experience block

Code:

Hide(self.Experience)
P3lim, if i use yours with
Code:

f:SetScript("OnShow", function() f.Hide end)
i get a
Code:

Interface\AddOns\oUF_Caellian\oUF_Caellian.lua:282: '=' expected near 'end'
. Line 282 is yours just above.


All times are GMT -6. The time now is 12:13 AM.

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