Thread Tools Display Modes
08-16-14, 12:47 PM   #41
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Kygo View Post
Ran into a problem adding LFDRole. It shows all 4 icons for everyone, not sure what or how do add it "correctly".
The problem is this:
Code:
	health.LFDRole = LFDRole
Elements must be "attached" directly to the frame, not the health bar or any other child frame/region. Even if the actual texture object is parented to the health bar, the "LFDRole" key still must be defined on the frame, not the health bar.

Originally Posted by Kygo View Post
On a scale 1-10, how difficult would it be to add element files to the code? I.e for Runes, Soul Shards, Holy power and eclipsebar.
Or would it just be easier to add code directly to the main file doing the same things?
I'm not really sure what you mean by "add element files" -- all of the elements you listed are supported by oUF, so you just have to create the objects. If you look in the oUF file for each element (holy power and soul shards are part of the class icons element, which also does monk chi; eclipse and runes have their own dedicated elements) you'll find a basic example you can use as a starting point.
__________________
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
08-16-14, 03:54 PM   #42
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Originally Posted by Phanx View Post
The problem is this:
Code:
	health.LFDRole = LFDRole
Elements must be "attached" directly to the frame, not the health bar or any other child frame/region. Even if the actual texture object is parented to the health bar, the "LFDRole" key still must be defined on the frame, not the health bar.
Okey, did not know that!

Originally Posted by Phanx View Post
I'm not really sure what you mean by "add element files" -- all of the elements you listed are supported by oUF, so you just have to create the objects. If you look in the oUF file for each element (holy power and soul shards are part of the class icons element, which also does monk chi; eclipse and runes have their own dedicated elements) you'll find a basic example you can use as a starting point.
Embed was the word I ment!

Saw in another thread (over a year old tho) about the lack of Burning Ember support nativly in oUF that you could either look on how people did add support for it in their unit frames or pull the default frame from Blizzards unit frames.
How could I embed for instance your BurningEmbers.lua into my code?
Or even write my own statusbars for them.


Did look in the classicons.lua in \oUF\elements, and wrote it into my code, used some parts on how-to from the CPoint section in my code. Holy Power,Chi and Soul Shards works, can't test if Shadow Ord works tho.
And I did just realize it was Burning Embers I ment over Soul Shards (now that I tested the classicons example!)

Last edited by Kygo : 08-16-14 at 03:56 PM.
  Reply With Quote
08-16-14, 09:37 PM   #43
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Elements that are included in oUF don't need to be duplicated in your layout. If you want to include third-party elements, like my BurningEmbers element, you'd just copy the whole file (in my case, Elements\BurningEmbers.lua) into your addon, and then create your own objects on your frame and hook it up to your frame just like you did for the ClassIcons element. I didn't bother with an example in the comment header, but you can use either bars, like the default Runes element:

https://github.com/haste/oUF/blob/ma...ar.lua#L27-L38

or simple textures, like the default ClassIcons element:

https://github.com/haste/oUF/blob/ma...ns.lua#L18-L30

Either of those examples will work; just rename them, and (in the case of class icons) reduce the number of sub-objects to 4. If your sub-objects are statusbars, the element will set their values to show partial embers. Otherwise, it will just show/hide them for full embers.

There's also oUF Warlock Spec bars, but since it hasn't been updated since 2012, I'm not sure whether it still works:

http://www.wowinterface.com/download...SpecsBars.html
__________________
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
08-17-14, 09:10 AM   #44
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Originally Posted by Phanx View Post
Elements that are included in oUF don't need to be duplicated in your layout. If you want to include third-party elements, like my BurningEmbers element, you'd just copy the whole file (in my case, Elements\BurningEmbers.lua) into your addon, and then create your own objects on your frame and hook it up to your frame just like you did for the ClassIcons element.
Got Burning Embers to work! Did use your BurningEmbers.lua file.


EclipseBar is written and working aswell now.
Also found that "SetReverseFill(1)" is a valid argument!


These two elements loads on classes they should not load on.
Did try to add "and unitClass == "WARLOCK" or unitClass == "PALADIN" or unitClass == "MONK" for the classIcons and "if unit == "player" and unitClass == "DRUID" in the EclipseBar, but with the "unitClass" segments they wont load at all.
Got the latest oUF from https://github.com/haste/oUF

Thought with this (from oUF\elements\eclipsebar, line 95 - 102) I should'nt need a "if class" segment but apperently I do..
Code:
	if(not form) then
		local ptt = GetSpecialization()
		if(ptt and ptt == 1) then -- player has balance spec
			showBar = true
		end
	elseif(form == MOONKIN_FORM) then
		showBar = true
	end
Code:
	-------------------------------
	--	Shards, Holy Power, Chi	 --
	-------------------------------

	if unit == "player" then
		local ClassIcons = {}
		for index = 1, 5 do
			local Icon = health:CreateTexture(nil, "OVERLAY")
			Icon:SetSize(16, 16)
			Icon:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", index * Icon:GetWidth(), 0, 20)
			Icon:SetTexture("Interface\\AddOns\\oUF_Kygo\\Media\\NCPoint")
			ClassIcons[index] = Icon
			
			
		end
	
		frame.ClassIcons = ClassIcons
	end
Code:
	-----------------------------
	-- 		Eclipse Bar		   --
	-----------------------------
	
	if unit == "player" then
	
		local EclipseBar = CreateFrame("Frame", nil, frame)
		EclipseBar:SetPoint("BOTTOM", health)
		EclipseBar:SetSize(140, 10)
		
		local SolarBar = CreateFrame("StatusBar", nil, EclipseBar)
		SolarBar:SetPoint("RIGHT", health, "RIGHT",  0, -22)
		SolarBar:SetStatusBarTexture("Interface\\AddOns\\oUF_Kygo\\Media\\Neal")
		SolarBar:SetStatusBarColor(0, 191, 255)
		SolarBar:SetReverseFill(1)
		SolarBar:SetSize(140, 10)
		
		local LunarBar = CreateFrame("StatusBar", nil, EclipseBar)
		LunarBar:SetPoint("LEFT", health, 0, -22)
		LunarBar:SetSize(140, 10)
		LunarBar:SetStatusBarTexture("Interface\\AddOns\\oUF_Kygo\\Media\\Neal")
		LunarBar:SetStatusBarColor(255, 255, 0)
   
		EclipseBar.LunarBar = LunarBar
		EclipseBar.SolarBar = SolarBar
		frame.EclipseBar = EclipseBar
   
		local spark = SolarBar:CreateTexture(nil, "OVERLAY")
		spark:SetSize(5, 10)
		spark:SetPoint("LEFT", SolarBar)
		spark:SetTexture("Interface\\PlayerFrame\\Direction_Eclipse")
		
		frame.spark = spark
		
		local perEclipse = SolarBar:CreateFontString(nil, "OVERLAY", "GameFontNormal")
		perEclipse:SetPoint("CENTER", EclipseBar, 0, -16)
		perEclipse:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 10)
		perEclipse:SetTextColor(1, 1, 1)
		frame:Tag(perEclipse, "[pereclipse]")
		
	end

Last edited by Kygo : 08-18-14 at 01:18 AM. Reason: Added more text...
  Reply With Quote
08-18-14, 04:55 AM   #45
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Kygo View Post
Did try to add "and unitClass == "WARLOCK" or unitClass == "PALADIN" or unitClass == "MONK" for the classIcons and "if unit == "player" and unitClass == "DRUID" in the EclipseBar, but with the "unitClass" segments they wont load at all.
You need to enclose multiple class checks in parentheses, or it won't work as intended. The way you've written it will only load if you're playing a warlock, since it's the equivalent of this:

Code:
if (unit == "player" and unitClass == "WARLOCK") or (unitClass == "PALADIN") or (unitClass == "MONK") then
Writing it this way should fix it:

Code:
if unit == "player" and (unitClass == "WARLOCK" or unitClass == "PALADIN" or unitClass == "MONK") then
On a side note, based on the name you gave it, I'm guessing you're defining unitClass inside your Spawn callback for each frame. This means that it will be nil for most frames, since information about other units' classes may not be available yet when the frames are being created, or the unit might not exist at all yet (for example, you can't have a target while logging in). Since the player frame is the only one where you're creating some elements conditionally, you should just define a class variable once for the player unit at the top of your file and refer to that:

Code:
local _, playerClass = UnitClass("player")
__________________
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
08-18-14, 01:40 PM   #46
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Originally Posted by Phanx View Post
You need to enclose multiple class checks in parentheses, or it won't work as intended.
Now I know that aswell!

Did split the four classes up into their own "if" statements so I could set diffrent settings for each of them.
  Reply With Quote
08-18-14, 03:05 PM   #47
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Kygo View Post
Did split the four classes up into their own "if" statements so I could set diffrent settings for each of them.
Most likely 90% of that code is the same for all classes, so you should avoid duplication, and just add sub-conditions inside for the few things you want to change:

Code:
if player and (one of these classes) then
     -- basic stuff

     if warlock then
          -- warlock stuff
     elseif monk then
          -- monk stuff
     elseif paladin then
          -- paladin stuff
     end

     -- more basic stuff
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
08-18-14, 08:25 PM   #48
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Finally got around to testing the aura bars and fixing them up today.

https://gist.github.com/Phanx/2f6904b6c6a568fa6630
__________________
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
08-18-14, 09:27 PM   #49
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Originally Posted by Phanx View Post
Most likely 90% of that code is the same for all classes, so you should avoid duplication, and just add sub-conditions inside for the few things you want to change:

Code:
if player and (one of these classes) then
     -- basic stuff

     if warlock then
          -- warlock stuff
     elseif monk then
          -- monk stuff
     elseif paladin then
          -- paladin stuff
     end

     -- more basic stuff
end
That is pretty much how I did it Currently have 1 overflow line of code in each of the classes, gonna fix it up later on today


Originally Posted by Phanx View Post
Finally got around to testing the aura bars and fixing them up today.

*Link removed, see Phanx post for it*
Lovely! Gonna check them out asap!

Last edited by Kygo : 08-19-14 at 12:02 PM.
  Reply With Quote
08-19-14, 12:02 PM   #50
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Awesome work Phanx! Works as a charm

Something I'm wondering about, how would I go around to fetch time remaning and aura name for two fontstrings?
Did some google-ing, could'nt find any real answer on how to fetch these strings
  Reply With Quote
08-19-14, 08:23 PM   #51
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Kygo View Post
... how would I go around to fetch time remaning and aura name for two fontstrings?
Did some google-ing, could'nt find any real answer on how to fetch these strings
You'd get them from UnitAura. Assuming you wanted to show that info on the bars, you'd want to create the font strings in the PostCreateIcon function, something like:

Code:
	local time = bar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
	time:SetPoint("RIGHT", -4, 0)
	bar.time = time

	local name = bar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
	name:SetPoint("LEFT", 4, 0)
	name:SetPoint("RIGHT", time, "LEFT", -2, 0)
	bar.name = name
Then in the PostUpdateAura function, use the values you're already getting from UnitAura. Set the name font string to display the name in the same place, and for auras with no duration, make sure you clear the time text. Then, update the time text in the OnUpdate function; it'll have a lot of digits after the decimal point, so you'll want to use SetFormattedText to restrict it to the number of decimal values you actually want to show.
__________________
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
08-20-14, 06:52 AM   #52
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Originally Posted by Phanx View Post
You'd get them from UnitAura. Assuming you wanted to show that info on the bars, you'd want to create the font strings in the PostCreateIcon function, ..
Added.
Did react to something (maybe it's supposed to happen?) when i wrote this
(Using Notepad++ with language set to LUA)
Code:
local time = bar:CreateFontString..
time:SetPoint..
time:SetTextcolor..
bar.time = time
Originally Posted by Phanx View Post
Then in the PostUpdateAura function, use the values you're already getting from UnitAura. Set the name font string to display the name in the same place.
Are you refering to "local function auras_PostUpdateIcon.."? If you're not, then I have missed that one.

Originally Posted by Phanx View Post
..use SetFormattedText ..
Alright. So something like this: "time:SetFormattedText(m:s)" ? (Havent gotten this far yet, still trying to figure half of this out )
  Reply With Quote
08-20-14, 08:49 PM   #53
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Kygo View Post
Did react to something (maybe it's supposed to happen?) when i wrote this
(Using Notepad++ with language set to LUA)
There is a global "time" function in Lua. Since you're not using it anywhere in your code, it doesn't matter, but if you prefer your editor not highlight it as a built-in global, just use another name.

Originally Posted by Kygo View Post
Are you refering to "local function auras_PostUpdateIcon.."?
Yes.

Originally Posted by Kygo View Post
So something like this: "time:SetFormattedText(m:s)" ?
fontstring:SetFormattedText(...) is the same as (but faster than) doing fontstring:SetText(string.format(...)) so just refer to the documentation for string.format to see what arguments you need to provide:

http://wowpedia.org/API_format
https://www.gnu.org/software/libc/ma...nt-Conversions

Or just look at other addons that display formatted time strings:

https://github.com/haste/oUF/blob/ma...stbar.lua#L371
__________________
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-30-14, 06:55 AM   #54
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Originally Posted by Phanx View Post
Finally got around to testing the aura bars and fixing them up today.

https://gist.github.com/Phanx/2f6904b6c6a568fa6630
Decided to fix this addon today.
Did notice that aurabars dosen't work properly anymore (did try to figure it out on my own, changed some values here and there that I thought would affect it, only broke it..).
The names and the bars show up as they should, but only on the player frame. Time shows up aswell but no countdown, just a static number.

Whole code that im using atm: http://pastebin.com/CFmayDw8
Aurabars code starts at line 12-93 and then 379-401

Merry christmas in after hand and happy new years!

Last edited by Kygo : 01-02-15 at 09:01 AM.
  Reply With Quote
01-02-15, 09:01 AM   #55
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Found a workaround for the aurabars not showing up on the target.
Did swap out
Lua Code:
  1. local ok = canApplyAura
to which works at least for now.
Lua Code:
  1. local ok = duration and duration > 0 and duration < 330

Something I can't wrap my head around is the fontstring format deal. Been trying various of lines.
The code I've been fiddling around with the most is
Lua Code:
  1. bar.timer:SetFormattedText("%.1f", duration)
and
Lua Code:
  1. bar.timer:SetFormattedText("%.1f", timeLeft)

See attachment to get a look on how it looks currently (it's just a static duration text)

Phanx gave me a couple of links to examples, but still having a hard time wrapping my head around it.

The error the above SetFormatted... code gives me. And if I swap "bar.timer" to "timer.bar" it gives the same error except it attempts to index field "bar".
Lua Code:
  1. 3x oUF_Kygo\Frames.lua:53: attempt to index field 'timer' (a nil value)
  2. oUF_Kygo\Frames.lua:53: in function 'PostCreateIcon'
  3. oUF\elements\aura.lua:130: in function <oUF\elements\aura.lua:83>
  4. oUF\elements\aura.lua:159: in function <oUF\elements\aura.lua:141>
  5. oUF\elements\aura.lua:293: in function <oUF\elements\aura.lua:287>
  6. oUF\elements\aura.lua:389: in function <oUF\elements\aura.lua:314>
  7. oUF\elements\aura.lua:430: in function 'func'
  8. oUF\ouf-1.6.8.lua:158: in function <oUF\ouf.lua:149>
  9. (tail call): ?
Attached Thumbnails
Click image for larger version

Name:	ForWoWIPost.png
Views:	235
Size:	175.0 KB
ID:	8410  
  Reply With Quote
01-05-15, 06:14 AM   #56
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Kygo View Post
Did notice that aurabars dosen't work properly anymore (did try to figure it out on my own, changed some values here and there that I thought would affect it, only broke it..)
The original code is working fine for me; I'm not sure why it wouldn't work for you, as nothing about the UnitAura API has changed. I went ahead and added name and time text, and some coloring, and a few other minor improvements, and added some explanatory comments:

https://gist.github.com/Phanx/2f6904b6c6a568fa6630
__________________
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
01-06-15, 09:41 AM   #57
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Originally Posted by Phanx View Post
The original code is working fine for me; I'm not sure why it wouldn't work for you, as nothing about the UnitAura API has changed. I went ahead and added name and time text, and some coloring, and a few other minor improvements, and added some explanatory comments:

https://gist.github.com/Phanx/2f6904b6c6a568fa6630
I think it was me that broke it
The new code works amazingly And cheers for the comments, made it a bit easier to understand what each thing does
  Reply With Quote
01-10-15, 03:37 PM   #58
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Could I put my own "custom" tags and other variables (such as texture paths, font paths and text color based on class) into a separate file?
Want to reduce the clutter and clean up the code a bit for my own sanity.
Trying to fiddle with it myself, but not really sure how to call for instance a texture path from "Settings.lua" to "Frames.lua"... Did look through a couple of oUF layouts I knew had a separate file for settings but it didn't really clear things up.

What I've got so far with "Settings.lua"
Lua Code:
  1. local addon, ns = ...
  2.  
  3.  
  4.     Textures = {
  5.         BTexture = [[Interface\\AddOns\\oUF_Kygo\\Media\\normTex2.tga]]
  6.         bgFile = [[Interface\\AddOns\\oUF_Kygo\\Media\\backdrop.tga]]
  7.         edgeFile = [[bgFile = Interface\\AddOns\\oUF_Kygo\\Media\\backdrop_edge.tga]]
  8.         Icon = [[Interface\\AddOns\\oUF_Kygo\\Media\\Neal_border.blp]] --ClassIcons (Soul Shards, Holy power etc)
  9.         CPoint = [[Interface\\AddOns\\oUF_Kygo\\Media\\NCPoint.blp]]
  10. }
  11.    
  12.     ClassPowerText = {
  13.         Priest = {26/255, 160/255, 255/255} --Mana
  14.         Shaman = {26/255, 160/255, 255/255} -- Mana
  15.         Warlock = {26/255, 160/255, 255/255} -- Mana
  16.         Paladin = {26/255, 160/255, 255/255} -- Mana
  17.         MonkMistweaver = {26/255, 160/255, 255/255} --How to check if monk is MW or not status: Unknown atm
  18.         Mage = {26/255, 160/255, 255/255} -- Mana
  19.         DruidResto/Balance = {26/255, 160/255, 255/255} -- Mana
  20.         Warrior = {255/255, 26/255, 48/255} -- Rage
  21.         DruidGuardian = {255/255, 26/255, 48/255} --Rage
  22.         Hunter = {255/255, 128/255, 64/255} -- Focus
  23.         Rogue = {255/255, 225/255, 26/255} -- Energy
  24.         DruidFeral = {255/255, 225/255, 26/255} -- Energy
  25.         DeathKnight = {0.00, 0.82, 1.00} -- Runic Power
  26. }
  27.  
  28.     Tags = {
  29.     oUF.Tags.Events["shorthp"] = "UNIT_HEALTH"
  30.     oUF.Tags.Methods["shorthp"] = function(unit)
  31.         if not UnitIsDeadOrGhost(unit) then
  32.             local hp = UnitHealth(unit)
  33.             return AbbreviateLargeNumbers(hp)
  34.         end
  35.     end
  36.  
  37.     oUF.Tags.Events["shortpp"] = "UNIT_POWER"
  38.     oUF.Tags.Methods["shortpp"] = function(unit)
  39.         if not UnitIsDeadOrGhost(unit) then
  40.             local pp = UnitPower(unit)
  41.             return AbbreviateLargeNumbers(pp)
  42.         end
  43.     end
  44.  
  45.     oUF.Tags.Events["shortname"] = "UNIT_NAME"
  46.     oUF.Tags.Methods["shortname"] = function(unit)
  47.         local name = UnitName(unit)
  48.         return string.sub(UnitName(unit), 1, 20)
  49.     end
  50.  
  51.     oUF.Tags.Events["readycheckicon"] = "DoReadyCheck"
  52.     oUF.Tags.SharedEvents["IsInGroup"] = true
  53.     oUF.Tags.Methods["readycheckicon"] = function(unit)
  54.         if unit == "player" and IsInGroup() then
  55.             return [[|TInterface\RAIDFRAME\ReadyCheck-Ready|t]]
  56.         end
  57.     end
  58.  
  59.     oUF.Tags.Events["rsicon"] = "PLAYER_UPDATE_RESTING"
  60.     oUF.Tags.SharedEvents["PLAYER_UPDATE_RESTING"] = true
  61.     oUF.Tags.Methods["rsicon"] = function(unit)
  62.         if unit == "player" and IsResting() then
  63.             return [[|TInterface\CharacterFrame\UI-StateIcon:0:0:0:-6:64:64:28:6:6:28|t]]
  64.         end
  65.     end
  66.     oUF.Tags.Events["combaticon"] = "PLAYER_REGEN_DISABLED PLAYER_REGEN_ENABLED"
  67.     oUF.Tags.SharedEvents["PLAYER_REGEN_DISABLED"] = true
  68.     oUF.Tags.SharedEvents["PLAYER_REGEN_ENABLED"] = true
  69.     oUF.Tags.Methods["combaticon"] = function(unit)
  70.         if unit == "player" and UnitAffectingCombat("player") then
  71.             return [[|TInterface\CharacterFrame\UI-StateIcon:0:0:0:0:64:64:37:58:5:26|t]]
  72.         end
  73.     end
  74.  
  75.     oUF.Tags.Events["leadericon"] = "GROUP_ROSTER_UPDATE"
  76.     oUF.Tags.SharedEvents["GROUP_ROSTER_UPDATE"] = true
  77.     oUF.Tags.Methods["leadericon"] = function(unit)
  78.         if UnitIsGroupLeader(unit) then
  79.             return [[|TInterface\GroupFrame\UI-Group-LeaderIcon:0|t]]
  80.         elseif UnitInRaid(unit) and UnitIsGroupAssistant(unit) then
  81.             return [[|TInterface\GroupFrame\UI-Group-AssistantIcon:0|t]]
  82.         end
  83.     end
  84.  
  85.     oUF.Tags.Events["mastericon"] = "PARTY_LOOT_METHOD_CHANGED GROUP_ROSTER_UPDATE"
  86.     oUF.Tags.SharedEvents["PARTY_LOOT_METHOD_CHANGED"] = true
  87.     oUF.Tags.SharedEvents["GROUP_ROSTER_UPDATE"] = true
  88.     oUF.Tags.Methods["mastericon"] = function(unit)
  89.         local method, pid, rid = GetLootMethod()
  90.         if method ~= "master" then return end
  91.         local munit
  92.         if pid then
  93.             if pid == 0 then
  94.                 munit = "player"
  95.             else
  96.                 munit = "party" .. pid
  97.             end
  98.         elseif rid then
  99.             munit = "raid" .. rid
  100.         end
  101.         if munit and UnitIsUnit(munit, unit) then
  102.             return [[|TInterface\GroupFrame\UI-Group-MasterLooter:0:0:0:2|t]]
  103.         end
  104.     end
  105.  
  106. }
  107.  
  108. ns.Settings = Settings
  Reply With Quote
01-10-15, 06:24 PM   #59
Ekaterina
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 65
It doesn't look like you are defining the Settings variable you are trying to add to your namespace table anywhere. Also, you've left off the commas on your tables, so this would throw an error that lua was expecting the tables to end after the first entry.

I'm not so sure about the oUF tags - not having coded for oUF myself, but I think you just leave those in the main chunk of the file, or their own tags file if you wish to completely separate them out. You are already adding them to a table by registering them with oUF. Phanx will no doubt correct me if I'm wrong.

Try the edited code below.
Lua Code:
  1. local addon, ns = ...
  2.  
  3.  
  4. --[[
  5.       Settings table
  6.       This should contain your textures, fonts and custom colors.
  7.       This can also be used to contain your positioning, whether or not a unit frame is enabled, etc
  8.  
  9. ]]
  10.  local Settings = {}
  11.  
  12.     Settings.Textures = {
  13.         BTexture = [[Interface\\AddOns\\oUF_Kygo\\Media\\normTex2.tga]],
  14.         bgFile = [[Interface\\AddOns\\oUF_Kygo\\Media\\backdrop.tga]],
  15.         edgeFile = [[bgFile = Interface\\AddOns\\oUF_Kygo\\Media\\backdrop_edge.tga]],
  16.         Icon = [[Interface\\AddOns\\oUF_Kygo\\Media\\Neal_border.blp]], --ClassIcons (Soul Shards, Holy power etc)
  17.         CPoint = [[Interface\\AddOns\\oUF_Kygo\\Media\\NCPoint.blp]],
  18. }
  19.    
  20.     Settings.ClassPowerText = {
  21.         Priest = {26/255, 160/255, 255/255}, --Mana
  22.         Shaman = {26/255, 160/255, 255/255}, -- Mana
  23.         Warlock = {26/255, 160/255, 255/255}, -- Mana
  24.         Paladin = {26/255, 160/255, 255/255}, -- Mana
  25.         MonkMistweaver = {26/255, 160/255, 255/255}, --How to check if monk is MW or not status: Unknown atm
  26.         Mage = {26/255, 160/255, 255/255}, -- Mana
  27.         DruidResto/Balance = {26/255, 160/255, 255/255}, -- Mana
  28.         Warrior = {255/255, 26/255, 48/255}, -- Rage
  29.         DruidGuardian = {255/255, 26/255, 48/255}, --Rage
  30.         Hunter = {255/255, 128/255, 64/255}, -- Focus
  31.         Rogue = {255/255, 225/255, 26/255}, -- Energy
  32.         DruidFeral = {255/255, 225/255, 26/255}, -- Energy
  33.         DeathKnight = {0.00, 0.82, 1.00}, -- Runic Power
  34. }
  35.  
  36.  
  37. ns.Settings = Settings
  38.  
  39. -- oUF_Kygo Tags
  40.  
  41.  
  42. oUF.Tags.Events["shorthp"] = "UNIT_HEALTH"
  43. oUF.Tags.Methods["shorthp"] = function(unit)
  44.     if not UnitIsDeadOrGhost(unit) then
  45.          local hp = UnitHealth(unit)
  46.           return AbbreviateLargeNumbers(hp)
  47.       end
  48. end
  49.  
  50.     oUF.Tags.Events["shortpp"] = "UNIT_POWER"
  51.     oUF.Tags.Methods["shortpp"] = function(unit)
  52.         if not UnitIsDeadOrGhost(unit) then
  53.             local pp = UnitPower(unit)
  54.             return AbbreviateLargeNumbers(pp)
  55.         end
  56.     end
  57.  
  58.     oUF.Tags.Events["shortname"] = "UNIT_NAME"
  59.     oUF.Tags.Methods["shortname"] = function(unit)
  60.         local name = UnitName(unit)
  61.         return string.sub(UnitName(unit), 1, 20)
  62.     end
  63.  
  64.     oUF.Tags.Events["readycheckicon"] = "DoReadyCheck"
  65.     oUF.Tags.SharedEvents["IsInGroup"] = true
  66.     oUF.Tags.Methods["readycheckicon"] = function(unit)
  67.         if unit == "player" and IsInGroup() then
  68.             return [[|TInterface\RAIDFRAME\ReadyCheck-Ready|t]]
  69.         end
  70.     end
  71.  
  72.     oUF.Tags.Events["rsicon"] = "PLAYER_UPDATE_RESTING"
  73.     oUF.Tags.SharedEvents["PLAYER_UPDATE_RESTING"] = true
  74.     oUF.Tags.Methods["rsicon"] = function(unit)
  75.         if unit == "player" and IsResting() then
  76.             return [[|TInterface\CharacterFrame\UI-StateIcon:0:0:0:-6:64:64:28:6:6:28|t]]
  77.         end
  78.     end
  79.     oUF.Tags.Events["combaticon"] = "PLAYER_REGEN_DISABLED PLAYER_REGEN_ENABLED"
  80.     oUF.Tags.SharedEvents["PLAYER_REGEN_DISABLED"] = true
  81.     oUF.Tags.SharedEvents["PLAYER_REGEN_ENABLED"] = true
  82.     oUF.Tags.Methods["combaticon"] = function(unit)
  83.         if unit == "player" and UnitAffectingCombat("player") then
  84.             return [[|TInterface\CharacterFrame\UI-StateIcon:0:0:0:0:64:64:37:58:5:26|t]]
  85.         end
  86.     end
  87.  
  88.     oUF.Tags.Events["leadericon"] = "GROUP_ROSTER_UPDATE"
  89.     oUF.Tags.SharedEvents["GROUP_ROSTER_UPDATE"] = true
  90.     oUF.Tags.Methods["leadericon"] = function(unit)
  91.         if UnitIsGroupLeader(unit) then
  92.             return [[|TInterface\GroupFrame\UI-Group-LeaderIcon:0|t]]
  93.         elseif UnitInRaid(unit) and UnitIsGroupAssistant(unit) then
  94.             return [[|TInterface\GroupFrame\UI-Group-AssistantIcon:0|t]]
  95.         end
  96.     end
  97.  
  98.     oUF.Tags.Events["mastericon"] = "PARTY_LOOT_METHOD_CHANGED GROUP_ROSTER_UPDATE"
  99.     oUF.Tags.SharedEvents["PARTY_LOOT_METHOD_CHANGED"] = true
  100.     oUF.Tags.SharedEvents["GROUP_ROSTER_UPDATE"] = true
  101.     oUF.Tags.Methods["mastericon"] = function(unit)
  102.         local method, pid, rid = GetLootMethod()
  103.         if method ~= "master" then return end
  104.         local munit
  105.         if pid then
  106.             if pid == 0 then
  107.                 munit = "player"
  108.             else
  109.                 munit = "party" .. pid
  110.             end
  111.         elseif rid then
  112.             munit = "raid" .. rid
  113.         end
  114.         if munit and UnitIsUnit(munit, unit) then
  115.             return [[|TInterface\GroupFrame\UI-Group-MasterLooter:0:0:0:2|t]]
  116.         end
  117.     end
  Reply With Quote
01-13-15, 03:11 PM   #60
Kygo
A Theradrim Guardian
 
Kygo's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 64
Did add the "," to every line, did also remove the "/" from "DruidResto/Balance" since it was giving me a error !
Did remove the tags from the Settings file and did add them back into the main file for now

Been fiddling a bit more now with how to call the different table contents (such as texture paths) into the main file, so far no luck.
Got "local Settings = ns.Settings" at the top the main file together with "local addon, ns = ..."
and in the Settings file I got the "local addon, ns = ..." and "local Settings = {}" at the top and on the bottom I have "ns.Settings = Settings".
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF_Kygo, a few tips wanted


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