• 0

    posted a message on Skinner
    Quote from Jncl
    The Auracle options frame uses the Ace3 skin. It is working for me, all the options and editboxes are visible.
    Have you tested this with the latest alpha builds of Ace? I only ask because the AceGUI widgets have been updated recently and at least one is a complete rewrite.
    Posted in: General AddOns
  • 0

    posted a message on declaring a function inside another function
    Unless I'm misunderstanding, you want:
    local A
    do
    	local function B()
    		-- Do stuff
    	end
    
    	function A()
    		-- Do stuff
    		B()
    		-- Profit?
    	end
    end
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on help with logical tests
    Like everyone else has said more information on the actual intent of the code is needed. Asking us to improve that particular piece of code could easily result in something completely useless to you.

    Things that would be nice to know:

    Will it always be those same 4 frames or is that just something you made up for an example?

    Will the frames have OnUpdate handlers and if so will they all have different ones or share just one?

    Will isRunning be used outside of what we have seen?

    How is the field "active" determined for frames outside of what you've shown, how frequently is it expected to change, and is it used by other code?

    How is the OnUpdate code shown started again once it shuts itself off?

    Are you more interested in the code being fast or in using little memory?

    The answers to those questions will determine what approach would yield the best results for what you want. That said, I still have no idea what it is that you are trying to accomplish.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Little help with this code?
    Provided its not just a typo:
    frame:Set[B]S[/B]cript("OnEvent", VB_OnEvent)
    


    On a side note, select(1, ...) is the same as just using ... by itself. Also, since you are only registering the one event you can just put the variable names in the function definition:
    local frame = CreateFrame('Frame')
    frame:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
    frame:SetScript('OnEvent', function(self, event, timestamp, type, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags)
    	if destName == "Val'kyr Guardian" and type == 'SPELL_SUMMON' and sourceName == "Rannasha" then
    		SendChatMessage("You face not Rannasha alone, but the Val'kyr I command!", 'SAY', nil, nil) 
    	end
    end)
    frame:Hide()
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on Blank lua error and broken blizzard UI
    Your lack of local scope variables and using such generic names is going to destroy the global namespace. From that code you linked:
    name,reaction,min,max,value = GetWatchedFactionInfo()
    You just changed five values in _G, two of which were math functions (min, max).
    Posted in: Lua Code Discussion
  • 0

    posted a message on Loosing variable table.. help
    I really don't understand why you have FrameGen and Bidder set up to be able to create multiple separate instances of each but only really need one of each. On top of that, in Bidder you do some things right as far as treating it like there will be separate instances but in other places it is set up like there is only Bidder and no instances inheriting from it. You seem to be treating the :new more like an extra initialization function than to truly create distinct separate instances of an object class (FrameGen is much better done than Bidder is this regard).

    As far as why your .OnEvent isn't working like you want is because of the above. You can't do bidwar = Bidder:new() which creates a private set of tables that inherit from Bidder and then have the inherited .OnEvent reference Bidder directly. There is no way in your code for Bidder.OnEvent to differentiate which instance of itself (created via Bidder:new) is being called for.

    FrameGen really should be rewritten slightly to be a library since that's how you are using it and Bidder should be rewritten to be a simple table with values and methods.

    Other areas for improvement:
    1. Replace getglobal() with _G[]
    2. Avoid
    function() SomeMethod(this) end
    , instead use
    function(self) SomeMethod(self) end

    3. A bit heavy handed on using global variables, use more locals
    4. Create a copy of a function and then reference to it, don't create multiple copies of the exact same function in a loop within an OnEnable method
    Posted in: Lua Code Discussion
  • 0

    posted a message on Loosing variable table.. help
    Any chance you could post more of the code? Like how is :new used and why does each copy need the same fixed values when you are using a metatable and could inherit those values instead? Shouldn't it be setmetatable(self, { __index = Bidder }) or is Bidder.__index defined in code we can't see? How are events getting to .OnEvent and why are you using Bidder.bLT instead of one of the returns from :new and indexing for it's .bLT? Why is there no Bidder.bLT defined in the code posted if you are referencing it and asking specifically about it?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Code Cleanup [Help Please]
    Since you want something for a more general use try:
    local function CallOnAllRegions(frame, type, method, ...)
    	if frame.GetRegions and method then
    		local regions, region = { frame:GetRegions() }
    		for index = 1, #regions do
    			region = regions[index]
    			if region[method] and (not type or region:IsObjectType(type)) then
    				region[method](region, ...)
    			end
    		end
    	end
    end
    
    local ModifyBackdrop
    do
    	local backdrop = { }
    	function ModifyBackdrop(frame, texture, red, green, blue, alpha)
    		if frame.SetBackdrop then
    			CallOnAllRegions(frame, 'Texture', 'SetTexture', nil)
    			backdrop.bgFile = texture
    			frame:SetBackdrop(backdrop)
    			frame:SetBackdropColor(red, green, blue, alpha)
    		end
    	end
    end
    
    ModifyBackdrop(WatchFrame, [[Interface\Tooltips\UI-Tooltip-Background]], 0, 0, 0, 0.75)
    
    -- WatchFrame specific fixes:
    
    WatchFrameCollapseExpandButton:SetAlpha(0.25)
    
    hooksecurefunc('WatchFrame_Collapse', function(self)
    	self:SetBackdropColor(0, 0, 0, 0)
    end)
    
    hooksecurefunc('WatchFrame_Expand', function(self)
    	self:SetBackdropColor(0, 0, 0, 0.75)
    end)
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on Code Cleanup [Help Please]
    local function HideAllTextures(...)
    	local region
    	for index = 1, select('#', ...) do
    		region = select(index, ...)
    		if region:IsObjectType('Texture') then
    			region:Hide()
    		end
    	end
    end
    
    HideAllTextures(WatchFrame:GetRegions())
    
    WatchFrame:SetBackdrop({ bgFile ="Interface\\Tooltips\\UI-Tooltip-Background" })
    WatchFrame:SetBackdropColor(0,0,0,.75)
    WatchFrameCollapseExpandButton:SetAlpha(0.25)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Fubar_CharmsFu throwing error
    Try changing that code block to (untested):

    245 local OnEnter = button:GetScript("OnEnter")
    246 button:SetScript("OnEnter", function(...)
    247 self.current_mouseover = button_name
    248 OnEnter(...)
    249 end)

    *Bolded line numbers are where the changes are.
    Posted in: AddOn HELP!
  • 0

    posted a message on Scroll Frames...*Sigh*
    Quote from Tekkub
    EXACTLY. Effectively it works the same way that the FSF template does... but you don't have to deal with the whole mess of unintuitive API and naming frames that the FSF template has... you just make you rows, save them in a table, make your scroll bar, set it's OnValueChanged (or whatever it was) handler to update the rows, and then set it's value once to trigger that first update. You don't need to track min/max or any of that stuff, you just set the min/max on the scrollbar and let it do the logics.

    I agree. The FSF template really just provides a way for scroll frames to emulate the behavior of a slider. Even Blizzard uses the FSF where a slider would have been more appropriate.

    Quote from Tekkub
    Only issue is that the scrollbars don't like to stick to exact ints, so you need to round their value off to get a proper int for your table offset.

    slider:SetValueStep(1) fixes that also
    Posted in: Lua Code Discussion
  • 0

    posted a message on Minor Issue
    I was thinking more along the lines of (rough outline):
    local menuShowing = false
    
    local function OnClick(self, button)
        if button == 'LeftButton' then
            -- Do stuff
        elseif button == 'RightButton' then
            -- Hide tooltip
            -- Show drop-down menu
            menuShowing = true
        end
    end
    
    local function OnEnter(self, motion)
        if menuShowing then
            -- Stop timer for hiding the drop-down menu
        else
            -- Show tooltip
        end
    end
    
    local function OnLeave(self, motion)
        if menuShowing then
            if motion then
                -- Start timer to hide the drop-down menu
            else
                -- Hide drop-down menu
                menuShowing = false
            end
        else
            -- Hide tooltip
        end
    end
    
    Posted in: Data Broker AddOns
  • 0

    posted a message on Minor Issue
    Quote from StormFX
    Ah. So is there anyway to hook into the object's OnDragStart or anything so I can my menu?
    If you are anchoring anything to a plugin then you would be much better off switching to using OnEnter/OnLeave just so you have an easy way to know when to hide it.
    Posted in: Data Broker AddOns
  • 0

    posted a message on Minor Issue
    I would like to bring attention to a minor issue. Some plugins seem to not be fully implementing their OnLeave handlers, specifically the second argument, motion, that it is passed. That argument evaluates as true if the OnLeave handler was called due to mouse movement, otherwise it means the frame lost focus for some other reason.

    When a plugin is being dragged the motion arg will evaluate as false. This should result in any attached drop-down menu or tooltip being removed immediately. Ignoring that second arg results in plugins being dragged and still having their tooltip (or a menu) attached when it shouldn't.

    Also, do NOT modify the frame that is passed as the first argument with OnEnter/OnLeave. You have no idea which display will be hosting your plugin and therefore don't know which fields are safe to modify.

    dataObj.OnEnter = function(self, motion)
    	self.tooltip = GameTooltip
    	< snip >
    end
    
    dataObj.OnLeave = function(self, motion)
    	if self.tooltip then
    		self.tooltip:Hide()
    		self.tooltip = nil
    	end
    end


    The 'self' in those functions does not end up being dataObj, so stop playing with your 'self'. :)
    Posted in: Data Broker AddOns
  • 0

    posted a message on DockingStation (Display)
    I have both those features added in my working copy. Not sure when it will be ready for an upload though.
    Posted in: Data Broker AddOns
  • To post a comment, please or register a new account.