WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF_Phanx, mouseovers (https://www.wowinterface.com/forums/showthread.php?t=46719)

Nastacia 06-21-13 03:55 PM

oUF_Phanx, mouseovers
 
I have a question about mouseover, is here a right place for asking?
I am trying to make the health and power value texts stick on the unitframes, not only when mouseovers. Which part should I edit? I tried to delete all lines about mouseovers but messed it up...

Mamantz 07-11-13 08:45 AM

Same here. I absolutely love the layout, would be great to see all the stats permanently and not just on mouseover.

Phanx 11-11-13 05:45 PM

Open the Functions.lua file in Notepad. Find every section that looks like this:

Code:

if self.parent.isMouseOver then
    X
else
    Y
end

and change it to just say:

Code:

X

RooR 12-09-13 03:12 PM

Maybe u can help me again . I need to remove the mouseover on my power and show values instead of percent only on power but leave the hp like it is default. And remove mouseover on target like when i target someone in pvp outside a fight wiht full hp i wanna see his max hp without mouseover.

Phanx 12-09-13 08:44 PM

If you only want to remove the mouseover change from the power text, then only make the above change in the section of the code that is related to the power text. It should be pretty obvious -- that section of the code is inside a function with "Power" in the name, beneath a comment block that says "Power", and calls lots of functions with "Power" in their name.

Even if you're unfamiliar with programming, instead of just going "omg code I don't get it, halp!" slow down and try to read it. Lua is a very easy language. It's basically giving instructions to the computer in plain English. And, if you break something, just undo your last change and try again. You're not going to make your computer explode or cause the sun to collapse into a black hole by raising a Lua error in WoW. It's okay to make mistakes -- that's how you learn.

As for the health text, find the PostUpdateHealth function (in Functions.lua, as the name might imply), go to the end of the function, and make the following change:

Code:

        elseif bar.__owner.isMouseOver or unit == "target" then
                bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitHealthMax(unit)))
        else
                bar.value:SetText(nil)
        end
end


RooR 12-10-13 08:46 AM

Health worked but im still trying to figure out the thing wiht the power. I basically wanna see mana/power values and not percent when im playing my priest.

Phanx 12-10-13 05:50 PM

Why? How is that remotely useful? Mana pools are fixed now. There is no reason to ever see anything other than a percent for mana values anywhere. :/

RooR 12-10-13 07:11 PM

Ok i figured it out but why cant i change those values. Like i just wanna reverse the health mouseover function on a target (current, and percent on mouseover)

Code:

        -- HEALER: deficit, percent on mouseover
        -- OTHER:  current, percent on mouseover


MoonWitch 12-10-13 09:03 PM

Quote:

Originally Posted by RooR (Post 287987)
Ok i figured it out but why cant i change those values. Like i just wanna reverse the health mouseover function on a target (current, and percent on mouseover)

Code:

        -- HEALER: deficit, percent on mouseover
        -- OTHER:  current, percent on mouseover


THere's a section called Power, look there.

I've copied the correct part in here and gave you comments on what part does what. Give it a try swapping out, it'll be fine :)

Lua Code:
  1. local _, type = UnitPowerType(unit)
  2.     local color = colors.power[type] or colors.power.FUEL
  3.     if cur < max then -- if current power is lower than the max power
  4.         if self.__owner.isMouseOver then -- if the unit is mouseover (and current power is lower than max power - nested if)
  5.             self.value:SetFormattedText("%s.|cff%02x%02x%02x%s|r", si(UnitPower(unit)), color[1] * 255, color[2] * 255, color[3] * 255, si(UnitPowerMax(unit)))
  6.             -- set the text to the current value.max value in colors
  7.         elseif type == "MANA" then -- else if the type of power is mana (and current power is lower than max power - nested if)
  8.             self.value:SetFormattedText("%d|cff%02x%02x%02x%%|r", floor(UnitPower(unit) / UnitPowerMax(unit) * 100 + 0.5), color[1] * 255, color[2] * 255, color[3] * 255)
  9.             -- set the power text to a percentage in colors
  10.         elseif cur > 0 then -- else if the current power is more than 0 (and current power is lower than max power - nested if)
  11.             self.value:SetFormattedText("%d|cff%02x%02x%02x|r", floor(UnitPower(unit) / UnitPowerMax(unit) * 100 + 0.5), color[1] * 255, color[2] * 255, color[3] * 255)
  12.             -- set power text to a percentage in colors
  13.         else-- in all other cases - no text for power
  14.             self.value:SetText(nil)
  15.         end
  16.     elseif type == "MANA" and self.__owner.isMouseOver then -- if current power is more than max power and it's mana and the unit is mouseover
  17.         self.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitPowerMax(unit)))
  18.         -- set power text to max power in colors
  19.     else
  20.         self.value:SetText(nil) -- set no text for power if none of the above is matched
  21.     end

Phanx 12-10-13 09:34 PM

Quote:

Originally Posted by RooR (Post 287987)
Ok i figured it out but why cant i change those values. Like i just wanna reverse the health mouseover function on a target (current, and percent on mouseover)

Code:

        -- HEALER: deficit, percent on mouseover
        -- OTHER:  current, percent on mouseover


Those are comments, not actual code. Changing the contents of a comment has no effect on the functionality of any code. They're just there to remind me (or tell other programmers who are looking at my code) what that section of code does.

RooR 12-11-13 03:06 AM

That helped a lot, thanks.

But the power section has nothing to do wiht the reversed (current, percent on mouseover) mouseover function for the health.

MoonWitch 12-11-13 11:37 AM

Quote:

Originally Posted by RooR (Post 287951)
Health worked but im still trying to figure out the thing wiht the power. I basically wanna see mana/power values and not percent when im playing my priest.

That made me look at the power section.

Sounds to me like you're trying to change quite a bit.

But if you're trying to change Health, look at the section Health :)

RooR 12-11-13 11:45 AM

Well i cant read out a function for that.

MoonWitch 12-11-13 12:28 PM

Quote:

Originally Posted by RooR (Post 288019)
Well i cant read out a function for that.

The part underneath what you quoted in the Health part (which you can see by
Lua Code:
  1. ------------------------------------------------------------------------
  2. --  Health
  3. ------------------------------------------------------------------------
:
Lua Code:
  1. -- HEALER: deficit, percent on mouseover
  2.     -- OTHER:  percent, current on mouseover
  3.  
  4.     if cur < max then
  5.         if ns.GetPlayerRole() == "HEALER" and UnitCanAssist("player", unit) then
  6.             if bar.__owner.isMouseOver and not strmatch(unit, "party%d") then
  7.                 -- don't change text on party frames, it's annoying for click-cast or mouseover healing
  8.                 bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitHealth(unit)))
  9.             else
  10.                 bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitHealth(unit) - UnitHealthMax(unit)))
  11.             end
  12.         elseif bar.__owner.isMouseOver then
  13.             bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitHealth(unit)))
  14.         else
  15.             bar.value:SetFormattedText("|cff%02x%02x%02x%d%%|r", color[1] * 255, color[2] * 255, color[3] * 255, floor(UnitHealth(unit) / UnitHealthMax(unit) * 100 + 0.5))
  16.         end
  17.     elseif bar.__owner.isMouseOver then
  18.         bar.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitHealthMax(unit)))
  19.     else
  20.         bar.value:SetText(nil)
  21.     end
  22. end

So what do you want to change to what for which bar?

Phanx 12-11-13 05:19 PM

Quote:

Originally Posted by RooR (Post 288019)
Well i cant read out a function for that.

As I said before, rather than just going "omg code, too hard, spoon-feed me the answer plz!" take a few minutes to slow down and just look at the code. Lua is almost plain English, with a little bit of simple math notation like + and - signs for adding and subtracting, < and > signs for comparing greater-than and less-than, and = signs for indicating that something is equal to something else.

For example, if you set aside your mental block and actually think about what this line could mean:

if cur < max then

... you should be able to figure out that it's checking "if" the current health (since "cur" is short for "current" and you're in a section about health) is less than (that's what "<" means in math) the maximum health (since "max" is short for "maximum") and if it is, "then" do what's written afterward.

Similarly, I think there's really only one possible interpretation of a line that says:

elseif bar.__owner.isMouseOver then

I'm willing to help, but there's a difference between helping you do something, and just doing it for you because you're unwilling to make any effort to help yourself. :rolleyes:

RooR 12-12-13 09:38 AM

Yea sry i found that and i clearly tried to change code there but i never got to the correct part but im getting it dont worry. Got it, thanks. Im new to this so yea im having lots of questions at the beginning to fit your awesome unitframes to my daily use :D


All times are GMT -6. The time now is 01:31 PM.

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