Thread Tools Display Modes
06-04-10, 06:24 AM   #21
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
right lets start from the start.

now i have a dri its called abbrev inside this i have

abbrev.toc and abbrev.lua

the toc i have abbrev.lua to call the lua.

and inside the abbrev.lua
i have

Code:
  classabbrev = {
      DRUID = "DR",
      HUNTER = "HT",
      MAGE = "MG",
      PALADIN = "PD",
      PRIEST = "PT",
      ROGUE = "RG",
      SHAMAN = "SH",
      WARLOCK = "WL",
      WARRIOR = "WR",
      DEATHKNIGHT = "DK",
  };
now i need somthing to call this into the oUF_Classic

now to do this i would like to add it next to the L80 "HT" of the mana bar

so i looked over and see that what was used was

Code:
		-- Info string
		local info = pp:CreateFontString(nil, "OVERLAY", "GameFontNormal")
		info:SetPoint("LEFT", 2, -1)
		info:SetPoint("RIGHT", -2, 0)
		info:SetJustifyH"LEFT"
		info:SetFont(GameFontNormal:GetFont(), 11)
		info:SetTextColor(1, 1, 1)

		self:Tag(info, 'L[level][shortclassification] [raidcolor][smartclass]')
		self.Info = info
so i see it uses smartclass that in game shows Hunter so there has to be a way i could add classabbev into that self:Tag

ie
Code:
self:Tag(info, 'L[level][shortclassification] [raidcolor][classabbrev]')
but that dont work due to it seems to be looking into the OUF code for classabbrev so i have to tell it otherwise.

so maybe the use of

Code:
oUF.Tags['shortclass'] = function(unit)
     local _, class = UnitClass(unit)
     return classabbrev[class]
end
oUF.TagEvents['shortclass'] = 'UNIT_NAME_CHANGED'
and then call

Code:
self:Tag(info, 'L[level][shortclassification] [raidcolor][shortclass]')
  Reply With Quote
06-04-10, 07:35 AM   #22
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Don't create a whole new addon, you need to add it to the layout file.
You also seem to have no idea how Lua or coding works, and thus you should read up on the Lua docs.

A tag is a reference to a function, and it doesnt allow arguments like how you try to do it.
  Reply With Quote
06-04-10, 12:42 PM   #23
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Code:
    local classabbrev = SetFontString(self.Power, myfont, 13, "THINOUTLINE")
    classabbrev:SetPoint("LEFT", self.Power, "LEFT", 2, 0)
    classabbrev:SetJustifyH("LEFT")

    self:Tag(classabbrev, "[abbrev]")
then i have

Code:
  oUF.Tags["[abbrev]"] = function(unit) 
    local string, tmpstring, sp = "", "", " "
    if UnitLevel(unit) ~= -1 then
      string = UnitLevel(unit)
    else
      string = "??"
    end
then the titles

Code:
  local classabbrev = {
      DRUID = "DR",
      HUNTER = "HT",
      MAGE = "MG",
      PALADIN = "PD",
      PRIEST = "PT",
      ROGUE = "RG",
      SHAMAN = "SH",
      WARLOCK = "WL",
      WARRIOR = "WR",
      DEATHKNIGHT = "DK",
   };
makes me also think maybe it should be like this.

Code:
   local classabbrev = {
    ["DRUID"] = { DR },
    ["HUNTER"] = { HT },
    ["MAGE"] = { MG },
    ["PALADIN"] = { PD },
    ["PRIEST"] = { PT },
    ["ROGUE"] = { RG },
    ["SHAMAN"] = { SH },
    ["WARLOCK"] = { WL },
    ["WARRIOR"] = { WK },
    ["DEATHKNIGHT"] = { DK },
  };
you see i am trying.

Last edited by weasoug : 06-04-10 at 01:22 PM.
  Reply With Quote
06-04-10, 04:19 PM   #24
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
This

Code:
  local classabbrev = {
      DRUID = "DR",
      HUNTER = "HT",
      MAGE = "MG",
      PALADIN = "PD",
      PRIEST = "PT",
      ROGUE = "RG",
      SHAMAN = "SH",
      WARLOCK = "WL",
      WARRIOR = "WR",
      DEATHKNIGHT = "DK",
   };
is absolutely correct. You're using it wrong. You can't put what I said in a tag (at least not the way you are trying). You have to put it in an OnUpdate function.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
06-05-10, 08:10 AM   #25
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Code:
local aggrotext = {
	[0] = 'Safe Threat',
	[1] = 'High Threat',
	[2] = 'High Threat',
	[3] = 'Aggro'
}
oUF.Tags['[customaggro]'] = function(u) 
	local reaction = UnitReaction('player', 'target')
	local status, threatpct 
	if UnitIsPlayer('target') and reaction == 5 and UnitExists('targettarget')then
		_, status, threatpct, _, _ = UnitDetailedThreatSituation('player', 'targettarget')
	else
		_, status, threatpct, _, _ = UnitDetailedThreatSituation('player', 'target')
	end
	if status and status >= 0 and UnitExists('target') and (UnitExists('pet') or UnitExists('Party1') or UnitExists('Raid1'))then
		return ('%.0f%% %s%s|r'):format(threatpct,Hex(GetThreatStatusColor(status)),aggrotext[status])
	else
		return ''
	end
end
That piece of code works great within my layout, so it would be ridiculous if your example wouldn't, Dawn.
He's just doing it wrong and he's not even trying how a tag works. You, and the others, gave him all he needed to do it, that's up to him now.
  Reply With Quote
06-20-10, 10:44 AM   #26
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Well this is where i am.

no errors. but the short class is not showing.

where have i gone worng.

Code:
  local classabbrev = {
      DRUID = "DR",
      HUNTER = "HT",
      MAGE = "MG",
      PALADIN = "PD",
      PRIEST = "PT",
      ROGUE = "RG",
      SHAMAN = "SH",
      WARLOCK = "WL",
      WARRIOR = "WR",
      DEATHKNIGHT = "DK",
   };
==

Code:
 local function updatePower(self, event, unit, bar, min, max)
    Class:SetText((classabbrev[UnitClass(unit)]) or (UnitCreatureType(unit)))
==

Code:
local function createTextStrings(self,unit)
    Class = SetFontString(self.Power, myfont, 13, "THINOUTLINE")
    Class:SetPoint("LEFT", self.Power, "LEFT", 2, 0)
    Class:SetJustifyH("LEFT")
==

self:Tag(Class, "[classtext]")


Code:
oUF.Tags["[classtext]"] = function(unit) 
    local string, tmpstring, sp = "", "", " "
    if UnitLevel(unit) ~= -1 then
      string = UnitLevel(unit)
    else
      string = "??"
    end

thanks for your time

Last edited by weasoug : 06-20-10 at 10:49 AM.
  Reply With Quote
06-20-10, 02:55 PM   #27
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
There's nothing in your tag that refer to your class abbreviation table.
You also don't need at all your updatepower function.

Code:
local classabbrev = {
      [DRUID] = "DR",
      [HUNTER] = "HT",
      [MAGE] = "MG",
      [PALADIN] = "PD",
      [PRIEST] = "PT",
      [ROGUE] = "RG",
      [SHAMAN] = "SH",
      [WARLOCK] = "WL",
      [WARRIOR] = "WR",
      [DEATHKNIGHT] = "DK",
}

oUF.Tags["[classtext]"] = function(unit) 
    local _, class = UnitClass(unit)
    local string
    if UnitLevel(unit) ~= -1 then
      string = UnitLevel(unit)
    else
      string = "??"
    end
    if classabbrev[class] then
      return classabbrev[class].." "..string
    else
      return UnitCreatureType(unit).." "..string
    end
end
And last question, do you even tried to understand what your were doing ?
  Reply With Quote
06-20-10, 05:44 PM   #28
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
I would like to think. i did try. but i also. went around looking how people do things. and copying and pasting. i guess not the best way.

but i know from what you put. might be a prob. as you have done

[DRUID] of what i know from other samples of this type of code. is used for Numbers. ie [0] = PowerBarColor["MANA"], -- Mana
as i use the same. for my colors in the ui im working on.

i think its like table index is nil when used, like [DRUID] so i guess i have missed something. or that the DRUID = "DR", is still the key.

well thanks again. it always nice to have some help.
  Reply With Quote
06-21-10, 12:48 AM   #29
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Code:
local classabbrev = {
      ["DRUID"] = "DR",
      ["HUNTER"] = "HT",
      ["MAGE"] = "MG",
      ["PALADIN"] = "PD",
      ["PRIEST"] = "PT",
      ["ROGUE"] = "RG",
      ["SHAMAN"] = "SH",
      ["WARLOCK"] = "WL",
      ["WARRIOR"] = "WR",
      ["DEATHKNIGHT"] = "DK",
}
Try it like this so... I did this "just like that" so might have some errors around.
  Reply With Quote
06-21-10, 06:04 AM   #30
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
thanks for that. i did mess about and got to the same place.

next well.

it would seem i made a boob. as when i target a npc. not tryed it on mobs yet. but on npcs it just says there a WR lol

but i lost the order as i used to have the OUF order. in Level race class. ii
but as it is. Class level.

i will be tryed to do the same for a short race. i have the abbrev done. but not adding it yet. due to i will sit down when at home. to work out. what i need to do. but at this time. before i added the class abbrev, i was getting Level race class, so im goiung to work on this 2st. before trying to add more abbrev



this is my code.

Code:
oUF.Tags["[classtext]"] = function(unit) 
    local _, class = UnitClass(unit)
    local string
    if UnitLevel(unit) ~= -1 then
      string = UnitLevel(unit)
    else
      string = "??"
    end
    if classabbrev[class] then
      return classabbrev[class].." "..string
    else
      return UnitCreatureType(unit).." "..string
    end
    string = string..sp
    local unitrace = UnitRace(unit)
    local creatureType = UnitCreatureType(unit)    
    if unitrace and UnitIsPlayer(unit) then
      string = string..unitrace..sp
    end   
    if creatureType and not UnitIsPlayer(unit) then
      string = string..creatureType..sp
    end    
    local unit_classification = UnitClassification(unit)    
    if unit_classification == "worldboss" then
      tmpstring = "Boss"
    elseif unit_classification == "rare" or unit_classification == "rareelite" then
      tmpstring = "Rare"
      if unit_classification == "rareelite" then
        tmpstring = tmpstring.." Elite"
      end
    elseif unit_classification == "elite" then
      tmpstring = "Elite"
    end    
    if tmpstring ~= "" then
      tmpstring = tmpstring..sp  
    end    
    string = string..tmpstring
    tmpstring = ""  
  end
thanks for all the help
  Reply With Quote
06-21-10, 12:56 PM   #31
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Wow what a mess
  Reply With Quote
06-21-10, 04:27 PM   #32
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Originally Posted by Rostok View Post
Wow what a mess
lol, oh
  Reply With Quote
06-22-10, 12:45 AM   #33
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
You really don't understand what you're doing, do you ?
Your tag is just ... just... wow and return only what i put in my previous post.
You should really try to learn a little bit more of lua before doing this sorts of thing.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Race & class


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