Thread Tools Display Modes
06-21-13, 03:55 PM   #1
Nastacia
A Kobold Labourer
 
Nastacia's Avatar
Join Date: Sep 2010
Posts: 1
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...

Last edited by Nastacia : 06-21-13 at 03:58 PM.
  Reply With Quote
07-11-13, 08:45 AM   #2
Mamantz
A Defias Bandit
Join Date: Jul 2013
Posts: 2
Same here. I absolutely love the layout, would be great to see all the stats permanently and not just on mouseover.
  Reply With Quote
11-11-13, 05:45 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-09-13, 03:12 PM   #4
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
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.

Last edited by RooR : 12-09-13 at 05:49 PM.
  Reply With Quote
12-09-13, 08:44 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-10-13, 08:46 AM   #6
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
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.

Last edited by RooR : 12-10-13 at 09:57 AM.
  Reply With Quote
12-10-13, 05:50 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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. :/
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-10-13, 07:11 PM   #8
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
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
  Reply With Quote
12-10-13, 09:03 PM   #9
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
Originally Posted by RooR View Post
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
  Reply With Quote
12-10-13, 09:34 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by RooR View Post
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-11-13, 03:06 AM   #11
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
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.

Last edited by RooR : 12-11-13 at 03:09 AM.
  Reply With Quote
12-11-13, 11:37 AM   #12
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
Originally Posted by RooR View Post
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
  Reply With Quote
12-11-13, 11:45 AM   #13
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
Well i cant read out a function for that.
  Reply With Quote
12-11-13, 12:28 PM   #14
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
Originally Posted by RooR View Post
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?
  Reply With Quote
12-11-13, 05:19 PM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by RooR View Post
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-12-13, 09:38 AM   #16
RooR
A Deviate Faerie Dragon
Join Date: May 2013
Posts: 19
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

Last edited by RooR : 12-12-13 at 09:42 AM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF_Phanx, mouseovers


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