CurseForge and Overwolf are joining forces!
Awesome More Information
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Shefki
    http://www.wowwiki.com/API_strsplit

    Not officially part of Lua but available in WoW.


    Thanks, the article helped, but funcion sucks a bit since its hard to get the last word using it since i dont know the number of words;P
    However little modification of workaround at the end is helpful XD
    for v in string.gmatch(" this   has     lots of   space   ", "%w+") do end


    After loop ends, v contains last word;P
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Kerecha
    A theoretical name2 isn't needed if u just aim for the space in "Verylongmob name" and remove the first part (since that normally is irrelevant information, the second part is usually the part that matters)


    Exactly the other way: go from the END of the string and register everything until first space;P
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Kerecha
    think he means something along the lines of

    Verylongmob name1
    Verylongmob name2

    When u trunc these u will get "verylongm" for both and be unable to tell em apart from the name.

    If i understand right he wants to "rip" the name1 and name2 part from the name (anything after the space, the part that tells them apart) and get something along the lines of "Ver name1" and "Ver name2) instead.


    Pretty much like this, but i'm only interested in name1 and name2.
    Hint to extract that part of the name would suffice.
    Maybe there is some equivalent to python's method string.split ?
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Can anyone help me with "ripping" last word (only separator to count is space) of targets name in LuaText?
    It would be useful with distinguishing between mobs like "Squarepant Destroyer" and "Squarepant Shooter" when you have truncated names;P
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Shefki
    Oops. Will be fixed in my next push. Does that resolve what you wanted it to do? Or did you still just only want the players name?


    It "almost" solved it. Was getting "Garaddon's Darkspear Raptor", but i wanted only "Garaddon". After a quick tutorial for gsub i achieved what i wanted;P
    However for raid frame it was a bit tricky to resolve driver's unitId.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Shefki
    The Name(unit) convenience function already does the work to handle this for you. Trust me when I say that you don't want to bother to implement this on your own.

    However the name of a players pet from a purely Blizzard API stand point is:
    UnitName(unit.."pet")

    Where unit is the unit for the player.


    Actually it does exactly what i don't want, it shows vehicle name;P
    		elseif unit:match("%d*vehicle%d*$") then
    			return VehicleName(unit)
    		end


    On every frame where is vehicle i want driver's name shown instead of vehicle.
    Anyway thanks for info.

    edit: took a close look and there is a bug in whole VehicleName function.
    For now output is "Darkspear Raptor's Darkspear Raptor" xD
    I'll try to look further and pick it out.

    edit2: found it:
    local owner_unit = unit:gsub("vheicle", "")

    See it?;P
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from toml
    OK, thanks. The Icon isn't that important for me right now. So temporarily it should be no problem using some sort of text indicator instead.

    EDIT:
    About counting buffs or debuffs, e.g. Sanity on Yogg:

    if UnitAura(unit,"Sanity",nil,"HARMFUL") then
      local _,_,_,count,_,_,_,_,_ = UnitAura(unit,"Sanity",nil,"HARMFUL")
      return count
    end


    Is this right?


    Yes, it's right. However you don't have to write _ after variables you are interested in, it will be automatically skipped.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    I know you are reading this, Shefki so ill post it here;P
    You seem to have forgotten to add PVP check in Hostilecolor function when rewriting it from dogtags. At least it looks like so since friendly players are marked as civillians.
    Posted in: Unit Frames
  • 0

    posted a message on PitBull 4.0
    A question: suppose i'm working on raid frame, so "unit" points to a raid member.
    How can i retrieve name of that player's pet?
    What i'm aiming for is to make raid members name shown even if they are in vehicle, without using pet frame. (But retaining other features of that player-pet exchange, like vehicle healt on bar etc..)

    Or should i refer to something like unit's driver? Since so far it seems like player is becoming vehicle's "pet" when entering vehicle.
    Posted in: Unit Frames
  • 0

    posted a message on PitBull 4.0
    Quote from Shefki
    I intend to build a page, hopefully today, with some documentation. You can take a look at the ScriptEnv.lua file for stuff that's available for now.

    http://www.wowwiki.com/API_UnitAffectingCombat

    You probably want HostileColors() for reaction colors. Keep in mind it while it shares a name with the DogTag it doesn't behave the same way. Take a look at the default Name texts to see how to use it.


    Already worked it out;P
    The most problems i had with correct events, because PLAYER_ENTERING_COMBAT applies only to melee autoattack;P

    And i have digged up DogTag colors directly from its lua files XD

    Btw i see we both wrote long answers to same question at the same time, look at the first post on previous page ^^

    BTW i didn't know that %02x converts to hex. I have spent some time with calc instead >< Does it accept only integers or fractions (like 0.56) are fine as well?

    Quote from Shefki
    I wish. I believe I've made it as large as AceConfig lets me at this point. You can always edit in a text editor and copy and paste. If you do so avoid using tabs, use spaces to indent. The game doesn't seem to have a clue how to render tabs.


    I don't know how about you, but tabs are working fine for me. It depends on the editor you copy from. I'm using Notepad++, which treats tabs as spaces XD
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from eilenda
    if we want for example PVP with the Duration, do we have to create that first in the LUA, then in the macro ?

    Can we shorten the name value so it contains only AFK, pvpduration, DEAD ?
    I personally always removed my name on my player frame as I know who I am :)

    I tried to suppress the name and keep the AFK but it says error.

    Can we add Color to some taggs ?

    May be someone who understand better how it works could give us some hints or some example ?


    As you probably noticed, in lua (and other C-based languages) generation of string of text has 2 "aspects": the format and variables.
    Look at this code (my player name):
    if UnitIsAFK(unit) then
         return "|cff33cc26%s (AFK)|r",Name(unit)
    elseif UnitIsDND(unit) then
         return "|cff33cc26%s (DND)|r",Name(unit)
    else
         return "|cff33cc26%s|r",Name(unit)
    end


    In " " you have the format, which includes static text (which will always be there) and spaces for entering variables (%s in above example). After format comes variables/functions generating string of text (%s is for strings, %d is for generic numbers etc.. google for it;P), which will fill the spaces you left.
    Note that the number of spaces and entered variables MUST match, or you will have an error.
    Other characters in my format string are because of WoW color formatting system. Basically it looks like this:

    |c<alpha><red><green><blue><YOUR_TEXT>|r

    Note that if you want to have default (white) text color, you just type the text;P

    UnitIsAFK(unit) and UnitIsDND(unit) are lua functions that return 1 (true) or nil (false) depending of "unit"'s state (in this case it's player).
    So basically in this example it shows green "Garaddon (AFK)" if i'm afk, "Garaddon (DND)" if i'm dnd and "Garaddon" if i'm neither afk nor dnd. (Garaddon is my char name;P)

    For other WoW functions look there: http://www.wowwiki.com/World_of_Warcraft_API and keep trying. It's the best way to learn;P



    edit: sorry for wall-of-text XD
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Is there a chance for some reference sheet of custom functions in lua module?
    Reverse engineering from built-in sample texts is a bit tough;P

    For now could anyone help me with checking if unit is in combat and retrieving reaction colors?;P
    I have strange feeling that we have to implement all DogTag colors from scratch now ><
    Posted in: Unit Frames
  • To post a comment, please or register a new account.