• 0

    posted a message on Identifying item links
    Quote from Torhal
    2. I'm confused about this - if the item ID is already at the beginning of the message, it was obtained from the link.


    My addon isn't the one that sends these messages, so I have to get it from the chat message myself. I find it easier to just get it at the front of the message.

    Thanks!
    Posted in: Lua Code Discussion
  • 0

    posted a message on Identifying item links
    I'm going to have messages like this in chat.

    7073 - |cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0|h[Broken Fang]|h|r


    1. What's the best way to check if that's an item link? I realize I have to compare the |Hitem part, but the only way I see to do that is regular expressions and that seems like overkill in my opinion.

    2. Would it be better to get the item ID from the link, or from the beginning of the message?

    3. Do item links work (automatically) in any frame? For example, in a font string?
    Posted in: Lua Code Discussion
  • 0

    posted a message on DBM should be removed from Curse and WoWI
    Quote from Tekkub
    If you've ever done any serious web development, you know that IE is the biggest PITA of all the browsers out there. :)


    This.

    On topic, i'd say the complaint about the gold seller ads should probably be sent to whoever maintains the website. It isn't Curse (or WoWInterface)'s responsibility to judge the people of the internet, anyone should be allowed to host their addons here, unless it's actually causing problems for Curse (or WoWInterface).
    Posted in: General Chat
  • 0

    posted a message on Nil
    I'm curious, why does Lua use nil rather than null (I realize it's the same thing, i'm referring to the term.), and where did the term 'nil' come from? Null came from mathematics, I can't think of anything called nil though.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hooking functions
    Quote from airscape
    Nope that didn't work either, infact it totally messed up the castbar :p


    Sorry, i'm just guessing really as I don't have WoW on this PC at the moment.

    Try searching through that file for ClearAllPoints(), as you can't move the frame after creating it without that. Whatever is moving it has to be calling that function.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hooking functions
    Quote from airscape
    Well that didn't work, I guess it uses SetPoint to create the bar in another function. Here's the full FocusFrame.lua for reference http://pastebin.com/m722bb2db


    I think this is your problem.

    function Focus_Spellbar_AdjustPosition ()
    	local yPos = 3;
    	if ( FocusFrame.debuffTotal > 4 ) then
    		yPos = 25;
    	elseif ( TargetofFocusFrame:IsShown() ) then
    		yPos = 30;
    	elseif ( FocusFrame.debuffTotal > 0 ) then
    		yPos = 15
    	end
    	FocusFrameSpellBar:SetPoint("BOTTOM", "FocusFrame", "BOTTOM", 20, -yPos);
    end


    So try this.

    FocusFrameSpellBar.Focus_Spellbar_AdjustPosition = function() end
    Posted in: Lua Code Discussion
  • 0

    posted a message on Something i want to make.
    Quote from ET20
            PowerBarColor["MANA"]["r"] = 0
            PowerBarColor["MANA"]["g"] = 144/255
            PowerBarColor["MANA"]["b"] = 255


    Tells me the purpose of the above code. i don't need to put that in but Variable names are part of making it easier to read. i chose ManaColor cux calling it jello or a color doesn't mean much to me. question tho can i put the rest of the power types in then let them be edited in the options?


    She didn't mean why did you name it "ManaColor". She meant why did you make it at all? You aren't using the variable, so there's no reason to make it.

    This is what it should be.

    	elseif event == "PLAYER_ENTERING_WORLD" then
    		PowerBarColor.MANA.r = 0
    		PowerBarColor.MANA.g = 144/255
    		PowerBarColor.MANA.b = 1
    
    		local _, powerType = UnitPowerType("player")
    		local color = PowerBarColor[powerType]
    		text:SetTextColor(color.r, color.g, color.b)
    Posted in: Addon Ideas
  • 0

    posted a message on Creating pretty bars
    This is just a guess, mind you, but for the flash effect, you probably could just switch the color (gradually, but fast) to white, and then back again (instantly, since the bar probably ran out by now.)
    Posted in: Lua Code Discussion
  • 0

    posted a message on FontString problem
    Quote from Phanx
    1. Are you intending that the CENTER of your font string is attached to the LEFT edge of your frame?

    2. By default, font strings have a CENTER horizontal alignment.

    3. If you do not set a width (whether explicitly via SetWidth, or implicitly with additional SetPoints) your font string will simply begin at the specified point and have no limit on its width.

    In your specific case, #2 and #3 mean that your font string is being center-aligned on a point 20 "WoW pixels" to the left of the middle of the frame's left edge. You're probably not seeing the offset because your text is center-aligned on that point, so it's overlapping the frame edge anyway.


    I actually figured it out and edited the first post about 10 minutes ago, the problem was that apparently you have to set both offsets or SetPoint will just ignore it. So I just added the Y offset and it works flawlessly. =)
    Posted in: Lua Code Discussion
  • 0

    posted a message on FontString problem
    SetPoint isn't working, it's positioning it on the left but offsets wont do anything, so I can't position it correctly. What am I doing wrong?

    mainFrame.titletxt = mainFrame:CreateFontString(nil, "OVERLAY", "GameTooltipText")
    mainFrame.titletxt:SetText("Test")
    mainFrame.titletxt:SetPoint("CENTER", mainFrame, "LEFT", 20)


    EDIT: Nevermind, I figured it out. You have to have both offsets in the function, even if you aren't using one of the two.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Timer
    Actually, this is what I already had. It just seems to me that running code for a timer say, 60 times a second is overkill.

    Thanks anyway.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Timer
    I know i've seen threads about this, but I can't for the life of me find them.

    What is the most efficient way to create a timer? I need to run a piece of code every five seconds.
    Posted in: Lua Code Discussion
  • 0

    posted a message on in-flight/swimming camera angle
    Not possible IIRC. You can't control the camera with LUA.
    Posted in: Addon Ideas
  • 0

    posted a message on Something i want to make.
    Quote from Torhal
    This is exactly why I haven't attempted to help with this. Specifically, the words in bold.


    Ditto.
    Posted in: Addon Ideas
  • 0

    posted a message on Something i want to make.
    Quote from Phanx
    Uhhh... that's not correct Lua syntax. It's also messy. Try this:

    local _, class=UnitClass("player")
    if class == "WARRIOR" then
         print("I am a Warrior. I have " .. UnitPower("player") .. " rage.")
    end


    Hmm, didn't know you could use underscores in that way. The brackets are because Lua syntax sucks (imo), and I tend to forget it doesn't use braces.

    On the rest, I did that on purpose. UnitPower was in a variable because he would be using it later. The WARRIOR conditional was there so he could disable his addon for classes that don't use it (I forgot about druids, though). I didn't use print because I test in WoWLua, and it puts print calls in its own frame, which I find annoying, so its a habit.
    Posted in: Addon Ideas
  • To post a comment, please or register a new account.