- Curse Premium
Member for 13 years, 5 months, and 18 days
Last active Fri, May, 12 2017 18:15:18
- 0 Followers
- 206 Total Posts
- 0 Thanks
Apr 24, 2009Posted in: Lua Code DiscussionQuote from OrionShockEh no, that would be bad.
Now if you need extra "data" for a tooltip, use a dictinary style look up or attach the referencnce to the frame when you set the debuff.
local debuffFrame_OnEnter = function(frame) GameTooltip:SetOwner(self, "ANCHOR_RIGHT") GameTooltip:SetText("~~") if frame.offset then --Find data in lookup table via frame.offset GameTooltip:AddLine("~~") end GameTooltip:Show() endWhat you can do then, when setting up the debuff frames, just set the frame.offset to what ever, then you can access that from with in your OnEnter call.
I think that fits with what your trying to do.
Yep, that should work, wasn't sure if I could just arbitrarily assign variables to frames or not >_<
Apr 23, 2009Quick question before I write all the code to do it, but would using closure to encapsulate the tooltip functions inside of my adddebuff function work, and more importantly retain the memory efficiency of declaring it as a local?Posted in: Lua Code Discussion
function AddDebuff(...) local function TooltipOnEnter(...) tooltip code here using a local variable like offset to set tooltip text properly end frame:SetScript("OnEnter". TooltipOnenter) end
That is to say, a locally defined tooltip template script, that uses closure on the offset parameter (which controls the debuff text). Thoughts?
Apr 23, 2009Posted in: Lua Code DiscussionQuote from XinhuanThe only other reason I can think of for the OnEnter/Leave not to work is that your debuff frames are not actualy detecting the mouse cursor. This would happen if there's some other transparent frame on top of them.
Also note that a new OnEnter/OnLeave function is created for each debuff frame. It will be wise to upvalue the function to local file scope, and just assign the function variable in the SetScript:
local myfunc = function(self, motion) print("this function ran") GameTooltip:SetOwner(self, "ANCHOR_RIGHT") GameTooltip:SetText("Debuff Tooltip!") GameTooltip:AddLine("Debuff Tooltip!") GameTooltip:Show() end function Overlord:AddDebuff(texture, offset) ... frame:SetScript("OnEnter", myfunc) ... end
I would, but wouldn't that be impossible if I wanted the tooltips to be different for each frame? Or is there some form of lamda notation I could use to write a local function that returns a function?
Or would it be better to only set the scripts if it's creating the frame originally, and then have the scripts just reference a variable tied to whatever debuff frame the script is set to? (ie. setscripts get tied in to the 'or CreateFrame' part of the code, and the GameTooltip:AddLine becomes 'GameTooltip:AddLine(debuffTooltips[offset])'
Now that I think about it, I like the way the idea I talked about in my first edit would work, but I can't think of any way to update that offset value to be correct... any ideas?
Apr 22, 2009Posted in: Lua Code DiscussionQuote from SeerahAre your frames mouse enabled?
You know... That might just be it. The parent frame is, but I don't think I'm setting it for the children. I'll give it a try when I'm at my work machine next.
Apr 22, 2009@Xinhaun: No luck with the extra hide(). There isn't any transparent frame on top of it. Frame strata is: Debuff Frame > Debuff Bar Frame > UIParent. At least there shouldn't be. If the bar frame was over the debuffs they'd be shaded out by the bar frame's backdrop, and they're not.Posted in: Lua Code Discussion
@Torhal: I'm aware, I've been meaning to change that line, I just keep getting side tracked every time I see it :P
Apr 22, 2009SetText didn't work, and the issue with the others is I want just my custom text in the tooltip, not the debuff information.Posted in: Lua Code Discussion
For simplicities sake, here's another pastey with the full code. http://www.pastey.net/112852
Apr 22, 2009Example code doesn't seem to function. No errors, no tooltip, and the rest of my code continues to work normally. Thoughts?Posted in: Lua Code Discussion
-- Add a debuff frame onto the main debuff bar function Overlord:AddDebuff(texture, offset) -- Create a local frame variable to hold the frame while we work local frame = nil -- Check if an already used frame is available, otherwise use a new frame frame = debuffFrames[offset] or CreateFrame("FRAME", nil, self.debuffBarFrame) -- Update our backdrop template with the texture we want debuffBackdrop.bgFile = "Interface\\Icons\\" .. texture -- Set the backdrop to our local frame frame:SetBackdrop(debuffBackdrop) -- Set the width / heigh of our local frame frame:SetWidth(16) frame:SetHeight(16) frame:ClearAllPoints() -- Set the local frame's anchor to the proper location for the given offset frame:SetPoint("TOPLEFT", self.debuffBarFrame, "TOPLEFT", 2 + (18 * offset), -2) -- Set up the tooltip functions for the frame frame:SetScript("OnEnter", function(self, motion) GameTooltip:SetOwner(self, "ANCHOR_RIGHT") GameTooltip:ClearLines() GameTooltip:AddLine("Debuff Tooltip!") GameTooltip:Show() end) frame:SetScript("OnLeave", function(self, motion) GameTooltip:Hide() end) -- place our local frame back into the frame recycling array debuffFrames[offset] = frame -- Update our parent frame's width to fit the new debuff self.debuffBarFrame:SetWidth(20 + (18 * offset)) end
Apr 21, 2009Just be careful to double check the spells you're looking at. Some talents apply a differently named buff/debuff than the talent themselves (Improved Shadow Bolt procs Shadow Mastery, for example).Posted in: Lua Code Discussion
A debuff example would be something like Ebon Plaguebringer, which actually applies a debuff named Ebon Plague. Another example would be Devistate, which procs sunder armor, not a debuffa named 'devistate' There's also the warrior ability Charge, which triggers the "Charge Stun" debuff
More than likely you won't encounter the few odd cases like those, but best to be aware of them :P
Apr 20, 2009Is there a tutorial and/or a good bit of code that I should be looking at for learning how to deal with the crazy mess that is the WoW gametooltip object?Posted in: Lua Code Discussion
Specifically, I'm looking to add custom tooltip text to a couple frames, not replace the tooltip system all together.
Apr 19, 2009That's what I was looking for, thanks! I figured there was something like that that I was missing, I just couldn't seem to figure out which one it was XD Works fine now.Posted in: Lua Code Discussion
Thanks again for all the help ^_^
Apr 19, 2009It's not the scaling that is the issue. It's changing profiles.Posted in: Lua Code Discussion
If you scale it to say 2, and then change profiles to something with a scale of 1, it STAYS at the scale of 2 until you console reloadui even though the variable controlling the frame scale has been changed. The only way for that to happen is for profile changing to not fire the set methods for all my options, which seems to be the case.
Also, the only other addons running on my test character are bugsack. Everything else is disabled for that character, and I get absolutely no errors at all.
Apr 18, 2009the entire body of Overlord.lua is in the pasty in my second post in this thread.Posted in: Lua Code Discussion
Maybe it has something to do with aceDBOptions calling the functions, but the functions themselves reference self rather than Overlord?
- To post a comment, please login or register a new account.