I eventually have to check mythicpl.us to see whats the ilvl reward for a certain dungeon I'm applying for, or what key should I aim to get a certain ilvl gear. This got old fast, I hate alt tabbing.
My idea was to add a tooltip to the dungeon finder window, similar to how the raider.io addon does, but displaying the table from https://mythicpl.us/ :
My questions: 1) How do I create such tooltip? I'm reading through raider.io code to understand how they do it, but I have yet to find it. 2) How do I attach this tooltip to that window?
Okay, this is coming from someone with more than 25 years in IT and I've seen this problem before.
That's a very discrete table with very clear, very limited information on it.
If it were me, I would simply format it neatly, print it out, and use some cellophane tape to stick the thing on the my monitor (top, bottom, or side, depending on how your rig is laid out).
The effort of putting that into a tooltip versus just doing the print-it-and-tape-it thing just doesn't seem justified.
I eventually have to check mythicpl.us to see whats the ilvl reward for a certain dungeon I'm applying for, or what key should I aim to get a certain ilvl gear. This got old fast, I hate alt tabbing.
I'm sorry, but I did see a reference to doing this for anyone else's benefit. I apologize.
Paste the following into the website addon.bool.no to create your addon. Fill in the lines I was too lazy to do. It will show a tooltip when you mouse over the eye (Topleft) local f = CreateFrame("Frame", nil, PVEFrame) f:SetPoint("TOPLEFT", PVEFramePortrait) f:SetPoint("BOTTOMRIGHT", PVEFramePortrait) f:SetScript("OnEnter", function(self) GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); GameTooltip:SetText("0 340 - -") GameTooltip:AddLine("2 345 355 340") GameTooltip:AddLine("3 345 355 340") GameTooltip:AddLine(" ... ") GameTooltip:AddLine("10+* 370 380 385") GameTooltip:Show() end) f:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
I eventually have to check mythicpl.us to see whats the ilvl reward for a certain dungeon I'm applying for, or what key should I aim to get a certain ilvl gear. This got old fast, I hate alt tabbing.
I'm sorry, but I did see a reference to doing this for anyone else's benefit. I apologize.
Well, sorry. But I assumed that making an addon only for myself wouldnt make sense.
Well, sorry. But I assumed that making an addon only for myself wouldnt make sense.
I make add-ons for myself all the time. I know others who do as well. Partly that's because they're very narrowly tailored add-ons and partly that's because I don't want to deal with the additional technical burden of figuring out the packaging at Curse and partly that's because I don't want to have to maintain them over time (if Blizzard yanks the rug out from under my code too badly, I can abandon the add-on with a clean conscience - without messing up anyone else's play who might have become dependent on it).
Paste the following into the website addon.bool.no to create your addon. Fill in the lines I was too lazy to do. It will show a tooltip when you mouse over the eye (Topleft) local f = CreateFrame("Frame", nil, PVEFrame) f:SetPoint("TOPLEFT", PVEFramePortrait) f:SetPoint("BOTTOMRIGHT", PVEFramePortrait) f:SetScript("OnEnter", function(self) GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); GameTooltip:SetText("0 340 - -") GameTooltip:AddLine("2 345 355 340") GameTooltip:AddLine("3 345 355 340") GameTooltip:AddLine(" ... ") GameTooltip:AddLine("10+* 370 380 385") GameTooltip:Show() end) f:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
I'm not sure which is easier or more useful ;)
wow, thanks a lot! Just for learning purposes, why f:SetPoint twice?
The two setpoints are making the frame the same position and size as the portrait texture ie, it's setting the top left point of the frame to the top left point of the texture, the second is stretching the bottom right of the frame to the bottom right point of the texture.
It's the same as f:SetSize(PVEFramePortrait:GetSize()) f:SetPoint("CENTER", PVEFramePortrait)
Without a :ClearAllPoints() :SetPoint() will just keep adjusting the various points without altering those already set.
Its almost ok... i just want to move it down a bit, so it can be ligned up with the top of the pveframe. Also, how could I properly format the information in the window?
Change: GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); To: GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:SetPoint("TOPLEFT", PVEFrame, "TOPRIGHT")
As for the formatting, that's probably the best you will get for multi column alignment without getting a whole lot more complicated. Lua doesn't treat multiple spaces in text strings as "hard".
local lootTable = CreateFrame("Frame", nil, PVEFrame) lootTable:SetPoint("TOPLEFT", PVEFrame) lootTable:SetPoint("BOTTOMRIGHT", PVEFrame)
local viewtable local function CreateViewTable(addbackground) viewtable = CreateFrame("Frame", "MythciPlusLootzViewer", UIParent) viewtable:SetSize(50, 50) viewtable:Hide() viewtable:SetPoint("TOPLEFT", PVEFrame, "TOPRIGHT") local last, lastline local widths = {} for i=1, #stringtable do for t=1, #stringtable[i] do local s = viewtable:CreateFontString() s:SetFontObject(GameFontNormalLarge) if i == 1 then s:SetTextColor(1, 1, 1) else s:SetTextColor(1, 1, 0) end s:SetText(stringtable[i][t]) if i == 1 and t == 1 then s:SetPoint("TOPLEFT", viewtable) viewtable.first = s elseif t == 1 then s:SetPoint("TOPLEFT", lastline, "BOTTOMLEFT") else s:SetPoint("LEFT", last, "RIGHT") end if i == 1 then widths[t] = s:GetWidth() else s:SetWidth(widths[t]) end last = s if t == 1 then lastline = s end end end if addbackground then local width = 0 for i=1, #widths do width = width + widths[i] end viewtable:SetSize(width + 10, (last:GetHeight() * #stringtable) + 10) local backdrop = { bgFile = "Interface/BUTTONS/WHITE8X8", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, edgeSize = 7, tileSize = 7, insets = { left = 2, right = 2, top = 2, bottom = 2, }, } viewtable:SetBackdrop(backdrop) viewtable:SetBackdropColor(0, 0, 0) viewtable.first:ClearAllPoints() viewtable.first:SetPoint("TOPLEFT", 5, -5) end end lootTable:SetScript("OnEnter", function(self) if not viewtable then CreateViewTable() end viewtable:Show() end) lootTable:SetScript("OnLeave", function(self) viewtable:Hide() end)
If you want the table to have a background, change: if not viewtable then CreateViewTable() end to: if not viewtable then CreateViewTable(true) end If the numbers get longer than the titles you may have to get creative with the title names or fix the FontString widths when creating row 1 (they determine the column widths) otherwise you should be able to just add/remove columns or rows, change titles/values to stringtable as needed.
Thanks a lot again. I will credit you for everything.
The frame shows up when I mouseover inside the pveframe, and hides when I mouse out. I wish it would load when I open the pveframe, and only hide when the pveframe is closed.
Also, how could I add some paddin to left and top of the frame? I tried by changing the inset values, but that didnt work.
local mplustable = CreateFrame("Frame", "MythciPlusLootzViewer", PVEFrame) mplustable:SetSize(50, 50) mplustable:SetPoint("TOPLEFT", PVEFrame, "TOPRIGHT") local last, lastline local widths = {} for i=1, #rewards do for t=1, #rewards[i] do local s = mplustable:CreateFontString() s:SetFontObject(GameFontNormalLarge) if i == 1 then s:SetTextColor(1, 1, 1) else s:SetTextColor(1, 1, 0) end s:SetText(rewards[i][t]) if i == 1 and t == 1 then s:SetPoint("TOPLEFT", mplustable) mplustable.first = s elseif t == 1 then s:SetPoint("TOPLEFT", lastline, "BOTTOMLEFT") else s:SetPoint("LEFT", last, "RIGHT") end if i == 1 then widths[t] = s:GetWidth() else s:SetWidth(widths[t]) end last = s if t == 1 then lastline = s end end end local width = 0 for i=1, #widths do width = width + widths[i] end mplustable:SetSize(width + 10, (last:GetHeight() * #rewards) + 10) local backdrop = { bgFile = "Interface/BUTTONS/WHITE8X8", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, edgeSize = 7, tileSize = 7, insets = { left = 2, right = 2, top = 2, bottom = 2, }, } mplustable:SetBackdrop(backdrop) mplustable:SetBackdropColor(0, 0, 0) mplustable.first:ClearAllPoints() mplustable.first:SetPoint("TOPLEFT", 5, -5)
Replace everything you had from the previous post with the code from the last. The last one has no mouseover at all, it just parents to the PVEFrame so it shows/hides when the PVEFrame does.
To adjust the padding, increase the 5 and 5 numbers in mplustable.first:SetPoint("TOPLEFT", 5, -5) and increase the 10 and 10 numbers in mplustable:SetSize(width + 10, (last:GetHeight() * #rewards) + 10) so they are twice the size of the numbres in the SetPoint line.
Adding in-game adjustments would require a mechanism to input a new table, save the new table for using next time, rebuild the display list with adjustments if there is any substantial difference ...
Learning lua and the WoW API mostly comes from looking at other addons or code created by Blizzard that makes up the entire default UI. https://wow.gamepedia.com/Viewing_Blizzard%27s_interface_code
Useful sites like https://wow.gamepedia.com/World_of_Warcraft_API
If you want to get into the nitty gritty of lua then https://www.lua.org/start.html NOTE: WoW uses lua version 5.1 as at the time of posting.
After that, it's trial and error and asking questions, usually in that order :).
Thanks a lot. Btw, is there a way to check if a certain addon is loaded? My loot table looks fine when raider.io windows is showing, but its floating in mid air when not. I'd like to adjust its position if raider.io isnt showing up or loaded.