• 0

    posted a message on Custom bonus action bar?
    Just trying to replicate some of the Blizzard code to understand how it works, and always good to know it general. I'm having an issue with recreating the bonus action bar though.

    I figured out that if you use action as the type for a secure action frame, but don't supply the action number it uses the ID and the bar offset. So that works well for the standard bar. For the bonus action bar there is a property called isBonus in the Blizzard code.

    My issue is that whenever I set isBonus to 1 like the Blizzard code, it taints the frame and so becomes useless. Is there any way to change isBonus without tainting the frame?

    Edit: Inheriting BonusActionButtonTemplate does the trick, but I would rather build the frame myself rather than using a Blizzard one.
    Posted in: Lua Code Discussion
  • 0

    posted a message on BonusActionBar Issues
    I found a solution although there is probably an easier way to do it. There is an extra attribute of action buttons called isBonus. If this is a true value then onClick it will act as a bonus action button instead of a regular one. This IS able to be changed in combat and will still function correctly. Using some basic SecureActionButton code I ended up making my own buttons that will behave like the Blizzard ones with the exception that they will change to bonus action buttons when necessary.

    I create frames in lua instead of XML (I have my reasons) so this is my code.

    for i = 1, 12 do
    	frames["ActionButton" .. i] = CreateFrame("CheckButton", nil, frames.Parent, "SecureActionButtonTemplate")
    	frames["ActionButton" .. i]:SetAttribute("type", "action")
    	frames["ActionButton" .. i]:SetID(i)
    	frames["ActionButton" .. i]:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
    	frames["ActionButton" .. i]:SetScript("OnEvent", function () UpdateCustomActionButton(this:GetID()) end)
    
    	... lots of code to replicate the ActionButtonTemplate ...
    end
    
    UpdateCustomActionButton = function (id)
    	local offset
    	if GetBonusBarOffset() == 0 or GetActionBarPage() ~= 1 then
    		frames["ActionButton" .. id]:SetAttribute("isBonus", nil)
    		offset = (GetActionBarPage() - 1) * 12
    	else
    		frames["ActionButton" .. id]:SetAttribute("isBonus", true)
    		offset = (GetBonusBarOffset() + 5) * 12
    	end
    	frames["ActionButton" .. id .. "Icon"]:SetTexture(GetActionTexture(id + offset))
    
    	... More code to update cooldowns, keybindings, names, etc ...
    end


    It is quite a mess of code to just move action bars, but at least it works. Hopefully I will find an easier way to do this in the future.

    Edit: Fixed taint issue in my code
    Posted in: Lua Code Discussion
  • 0

    posted a message on BonusActionBar Issues
    I have made a HUD and it works quite well. However, I am trying to put the action buttons in the middle in two rows of 6. This is turning out to be alot harder than I thought though. I have rebinded ActionButton1 and ActionButton7 to where I wanted and binded BonusActionButton1 and BonusActionButton7 to the exact same locations. Everything worked fine until I had to switch to the bonus bar. Within my code, I am changing the alpha to prevent the action bars from showing through each other so there isn't an issue with visibility. However, the keys are not rebinding to the bonus action bar and even dragging and dropping actions will bind them to the original action bar instead of the bonus one. Since these are secure frames I won't be able to use show, hide, change frame strata, move or unbind mouse which would be common solutions to this. I have also tried merge the bars together into a single set of custom buttons but that doesn't seem to be possible. Any ideas?? It shouldn't be that complicated so I'm sure that I'm just missing something really stupid.
    Posted in: Lua Code Discussion
  • 0

    posted a message on EditBox creation via lua
    I got it.

    frames.SetName:SetFontObject("GameFontHighlight")


    Seems to work.
    Posted in: Lua Code Discussion
  • 0

    posted a message on EditBox creation via lua
    I am attempting to remove all xml code from a mod. I have been able to get most things to work using pure lua. However, edit boxes will not display text correctly.

    frames.SetName = CreateFrame("EditBox", nil, frames.Parent)
    frames.SetName:SetWidth(160)
    frames.SetName:SetHeight(20)
    frames.SetName:SetPoint("TOPLEFT", frames.Parent, "TOPLEFT", 5, -10)


    That's the basis of the code, with of course textures and such binded to it. However, I cannot input text or even set the text with code. I do however get a blinking cursor.

    From WoWWiki:

    <EditBox name="TestEditBox">
       .. Size
       .. Anchors
       .. Layers
       .. etc.
       
       <FontString inherits="GameFontNormal"/>
    </EditBox>


    "EditBox will not display any text without the FontString object, just the blinking cursor --watchout (7 June 2006, WoW 1.10)"

    And so I tried:

    frames.SetNameText = frames.SetName:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
    frames.SetNameText:SetAllPoints(frames.SetName)


    and

    frames.SetName:CreateFontString(nil, "OVERLAY", "GameFontHighlight")


    and

    frames.SetName:SetFont("FRIZQT__.TTF", 12)


    But still no text entry.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Replacing all Blizzard mods??
    Ok ... I'll give on this one then. I guess this just turned out to be the rantings of a forum troll after all. Thanks for all the info though.
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    I'm removing the contents of the frame so yes it would remove the contents in C as well. As far as the GC, yes it would no be removed until the next GC but there isn't any way to call a GC so that will have to do.

    I wish I knew more C. I may be incorrect about hash tables but I have tested this with many million reps and tables with fewer values are always faster. So it may be a fluke but I am simply stating a fact I have learned from testing.
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    I'm not talking down to you. There is no way that ANY program can instantly find a value. The time taken to find a value might not be significant without several million or possibly billion queries but there IS a time difference depending on the size of the database.
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    Define "delete"

    My definition is removing something from memory.
    Isn't that what that does?
    True it does leave a single blank variable behind but it deletes all attributes of that frame and recursively performs this on all children
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    And as far as deleting frames; you are right to some extent; you cannot delete frames directly. But I might as well share:

    DeleteFrame = function (frame)
    if type(frame[0]) == "userdata" then
    local children = {frame:GetChildren()}
    for key, value in next, children do
    DeleteFrame(value)
    end
    local regions = {frame:GetRegions()}
    for key, value in next, regions do
    DeleteFrame(value)
    end
    frame:Hide()
    frame[0] = nil
    frame.firstTimeLoaded = nil
    end
    end
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    Just a note to Industrial. Yes, it's faster to retrieve globals using the method you mentioned however it will be slower than an exclusive table with a limited amount of variables since when you call a key it has to search the entire table for that key. The best idea would be to use setfenv to call the globals initially but a caching system will still improve speed.
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    My initial purpose wasn't to improve the Blizzard UI. It was to make an addon that would include the best features of many mods yet still be faster than the default UI.
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    As much as I hate being called a forum troll I guess I expected it considering what I'm proposing. It's no surprise that triggering multiple OnUpdate events is slower than a single event. So why not expand that and use a single OnUpdate and a single OnEvent function which would then point off to the other functions as needed. It's no surprise that I can load a mod with less memory and CPU power. I'm removing all blizzard code from memory that I don't need. That includes OnUpdate events which save CPU during load. It's quite a simple concept and shouldn't be that hard to accept.
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    Ok ... here's an example

    FrameXML/BuffFrame.xml

    function BuffButton_OnUpdate()
    local buffDuration = getglobal(this:GetName().."Duration")
    ...
    BuffFrame_UpdateDuration(this, timeLeft)
    ...
    end

    Isn't it overkill to grab buffDuration every frame?

    It could be assigned once as:

    this.buffDuration = getglobal(this:GetName().."Duration")

    And a buff duration update would work just as well every 1/2 second or so.
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    I doubt slouken would approve of what I'm doing to replace the blizzard UI. Most of it is replacing slow calls such as getglobal with cached values and taking out repetitive code like OnUpdate events that really don't have to be executed every frame.
    Posted in: Addon Ideas
  • To post a comment, please or register a new account.