WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF tutorial layout for oUF 1.4 (https://www.wowinterface.com/forums/showthread.php?t=33566)

Icerat 07-18-10 02:57 PM

Quote:

Originally Posted by Dawn (Post 198625)
Try to set name:SetHeight(set it to yourfontsize). This should prevent the name from switching to a second line, in theory. However, the best solution would be to abbreviate names.

Hi thanks for the reply, I'm a complete noob, how do I abbreviate names?

Politig 07-18-10 10:47 PM

It's been a while since I looked at some coding, but I've added this into lib.lua:

Code:

  --gen hp strings func
  lib.gen_hpstrings = function(f)
    --health/name text strings
    local name = lib.gen_fontstring(f.Health, cfg.font, 13, "THINOUTLINE")
    name:SetPoint("LEFT", f.Health, "LEFT", 2, 0)
    name:SetJustifyH("LEFT")
   
    local hpval = lib.gen_fontstring(f.Health, cfg.font, 13, "THINOUTLINE")
    hpval:SetPoint("RIGHT", f.Health, "RIGHT", -2, 0)
    --this will make the name go "..." when its to long
    name:SetPoint("RIGHT", hpval, "LEFT", -5, 0)
   
    f:Tag(name, "[name]")
    f:Tag(hpval, "[curhp]/[perhp]%")

    if self.mystyle == "player" then
        name:Hide()
    else
        name:Show()
    end

end

Inserted the red portion. For some reason, adding that makes the frames not show up at all. What am I doing wrong :confused:

Icerat 07-19-10 11:18 AM

I had to use the following to get it to show the name in different loactions depending updon frame.
Code:

--gen name string func
          lib.gen_namestring = function(f)
        --name text string
                local name = lib.gen_fontstring(f.Health, cfg.font, 9, "THINOUTLINE")
                        if f.mystyle == "player" then
                                name:SetPoint("LEFT", f.Health, "LEFT",28, 10)
                                elseif f.mystyle == "target" then
                                name:SetPoint("LEFT", f.Health, "LEFT",28, 10)
                                name:SetWidth(100)
                                else
                                name:SetPoint("LEFT", f.Health, "LEFT", 0, 10)
                        end
                f:Tag(name, "[name]")
        end

Think I tried self.mystyle when I was trying to figure out how to move the text and it didn't work and found out f.mystyle worked.

Not 100% sure why it worked but it did maybe one of the experts in here could elaborate?

Mischback 07-19-10 12:46 PM

Just have a look on your function... You pass a frame (SELF) as "f" in the function-prototype... In your code, Politig, "self" is just not visible inside of the function, but the (function local) variable "f" is.

Perhaps you may want to google "variable scoping" to find some in depth explaination.

xandora 07-21-10 02:43 AM

Trying to figure out how to add mana/power values to the Power bar with this layout.

I assumed it was as simple as copying the code for the HP text and changing everything to Power... but apparently it's not!

Was I on the right track?

Icerat 07-21-10 11:09 AM

I did the following:

lib.lua added:
Code:

--gen pwr strings func
        lib.gen_pwrstring = function(f)
    -- Power string
                local pwrval = lib.gen_fontstring(f.Health, cfg.font, 9, "THINOUTLINE")
                pwrval:SetPoint("RIGHT", f.Health, "RIGHT", -2, -13)
   
                f:Tag(pwrval, "[curpp] [maxpp]")
        end

then added to the player section of core.lua
Code:

lib.gen_pwrstring(self)
have a look at ouf > elements > Tags > tags.lua show tags you can use or you could make your own, that's what I'm playing about learning at mo :)

drakull 09-13-10 06:34 PM

Hi,

Firstly I want to thank you for this tutorial addon... although I'm an experienced coder, my knowledge of LUA still very basic. Tried (hard) to create an ouf layout a few times but never got anywhere, now i have my dream layout (nothing new, just bits of many different layouts i like) almost finished and that's thanks to you, Zork.

Now maybe you can help me with some issues i'm having:
- Can't save the raidframe's position, and moving it is a complete mess;
- The player/target/etc frames positions are saved, but they reset from time to time;
- I can't figure out how to make the raidframe's style horizontal (and bottom anchored). Like this:

raidmember21 raidmember22 raidmember23 raidmember24 raidmember25
...
raidmember06 raidmember07 raidmember08 raidmember09 raidmember10
raidmember01 raidmember02 raidmember03 raidmember04 raidmember05

Alternatively, I want to manually especify each unit's default starting position in the cfg.lua but this i already have figured out how to achieve... at least i think so.

Any help is much apreciated!

PS: excuse my poor english, is not my mother tongue.

zork 09-14-10 02:05 AM

RaidFrames aswell as party do not have a specific global frame on their own. They use so called headers to anchor on.

The trick with moving them is to create a new helper frame each for party and raid. The frame could be made drag'able so you could move stuff ingame. Important is that you give it a global name.

Code:

local f = CreateFrame("FRAME", "MyGlobalPartyFrameName", UIParent)
Now anchor your first raid header and your party header to those drag frames.
Since all the other raid frames are bound to the first one (you do this in your layout, check other raid layouts) they will move once you drag the dragframe around.

If you want to reanchor your raidframes try this. Play with the SetPoints and the xOffset.

Code:

    local raidDragFrame = CreateFrame("FRAME", "myRaidDragFrame", UIParent)
    raidDragFrame:SetWidth(70)
    raidDragFrame:SetHeight(70)
    raidDragFrame:SetPoint("CENTER",UIParent,"CENTER",0,0)
    lib.moveme(raidDragFrame)

    local raid = {}
    for i = 1, NUM_RAID_GROUPS do
      raid[i] = oUF:SpawnHeader("oUF_Raid"..i, nil, "raid",  "groupFilter", i, "showRaid", true, "xOffSet", 20, "point", "LEFT")
      if i == 1 then
        raid[i]:SetPoint("CENTER", raidDragFrame, "CENTER", 0, 0)
      else
        raid[i]:SetPoint("BOTTOMLEFT", raid[i-1], "TOPLEFT", 0, 10)
      end
    end

http://www.wowwiki.com/API_Region_SetPoint

Dawn 09-14-10 01:17 PM

Why are you still implementing a way to move frames with oUF_MoveableFrames being released and working fine for so long? It doesn't even require authors to support it from within the layout. :rolleyes:

zork 09-14-10 02:06 PM

Why should I use a mod if I can create a move function with 5 lines myself and still have full controll over its functionality?!

Dawn 09-14-10 07:55 PM

Because it offers more utility. Like a slash command that locks/unlocks it, it highlights frames also some of those not currently spawned, it saves positions, resets them, ... all of this in game, no need to open up notepad or whatever, which is still not common for A LOT of users.
The user can decide whether he wants to be able to move the frames in game or not, or just by himself via editing the layout's code and thus using zero additional lines of code, ... :rolleyes:

I know you could do this, too, but not with 5 lines of code... after all it's up to you, ofc. I was just curious.

drakull 09-16-10 07:01 AM

Layout is set, have implemented raid marks, lfd icons, rest/combat indicators, created some new tags for especific use (mostly for raid frames). Looking good!
Now i am trying to implement timers for buffs/debuffs, finding a way to desaturate other's players buffs/debuffs like in ouf_caellian and adding support for interruptible spells to the castbar (different border color, something like that).

Still can't find a way to hide the blizzard default buffs/debuffs frame tho, i think it should be automatic as i already have buffs/debuffs for the playerframe. :(

PS: is there a way to create fake raid members and buffs? it would help a lot.

thelurkerbelow 09-28-10 09:49 AM

Used your tutorial layout as an excuse to start messing about with oUF, but I've come across a bit of an issue. The status bar objects don't really behave like "normal" status bars: instead of the texture remaining static and filling/depleting based on value, the entire texture resizes itself.

Is this something that's particular to this tutorial layout that I haven't figured out yet, or is this an intrinsic "feature" of oUF itself?

Dawn 09-28-10 10:19 AM

That's the normal behaviour of oUF's health update function. You would need to adept this function to "fill/deplete" the texture instead of "resizing" it.
Which means it's entirely possible, but not by default.

zork 09-28-10 11:03 AM

Make sure to add:
Code:

    yourTexture:SetVertTile(true)
    yourTexture:SetHorizTile(true)

You may only want vertical or horizontal, so you can disable the other. Try/error which one. No need to adjust the function, just add some more values that handle how the texture is tiled. Those are pretty new API calls.

thelurkerbelow 09-28-10 11:53 AM

Quote:

Originally Posted by Dawn (Post 207591)
That's the normal behaviour of oUF's health update function. You would need to adept this function to "fill/deplete" the texture instead of "resizing" it.
Which means it's entirely possible, but not by default.

Hmm. Seems a bit odd that by default it would make status bars behave completely differently than...uhh...status bars. :confused:
Quote:

Originally Posted by zork (Post 207595)
Make sure to add:
Code:

    yourTexture:SetVertTile(true)
    yourTexture:SetHorizTile(true)

You may only want vertical or horizontal, so you can disable the other. Try/error which one. No need to adjust the function, just add some more values that handle how the texture is tiled. Those are pretty new API calls.

This just seems to make the texture "slide" instead of stretch/resize.

Bit of a deal-breaker for me, as most of my UI work deals with non-symmetrical bar textures. Worth a go, I suppose. Thank you anyway.

Dawn 09-28-10 12:13 PM

oUF is currently updated for Cataclysm. Feel free to suggest an API change regarding this issue over here. Who knows what haste is gonna say, maybe he'll change the default health update. ;)

drakull 10-02-10 10:45 AM

Just to say thanks again and to let you know that my layout is ready, please take a look and let me know what you think. ;)

http://www.wowinterface.com/download...4-ouf_Drk.html

Still have some minor bugs to address and lots of things to implement but i'm really proud of myself. ;)

Eveigh 10-05-10 01:24 PM

Started to mess around with oUF and your layout.
One thing bugs me a lot - if I "declare" a text in a "lib.lua", i can't attach actual text tag to it in "core.lua".
In "lib.lua", tags are attached simple:
Code:

f:Tag(name, "[name]")
However, when i try to do it in "core.lua" like this:
Code:

self.Tag(name, "[curhp]")
It just won't show me anything. I'm kind of lost.
Help me, please :3

yj589794 10-05-10 01:49 PM

Quote:

Originally Posted by Eveigh (Post 208162)
Started to mess around with oUF and your layout.
One thing bugs me a lot - if I "declare" a text in a "lib.lua", i can't attach actual text tag to it in "core.lua".
In "lib.lua", tags are attached simple:
Code:

f:Tag(name, "[name]")
However, when i try to do it in "core.lua" like this:
Code:

self.Tag(name, "[curhp]")
It just won't show me anything. I'm kind of lost.
Help me, please :3

Without seeing your code we can not tell you exactly what the issue is. could you post a link to your code?


All times are GMT -6. The time now is 07:18 AM.

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