Help Clearing Text OnHide
I am having trouble figuring out how to clear or update text once it has been displayed. The below script creates the text onshow. The timer starts and if I have an empty item slot and equip it then it will update. However, should I remove the item the text remains. Swapping items creates new text but it is overlayed onto the old text.
Any help would be appreciated. Cheers! EDIT: This is for Legion/PTR. This also works (except for the above issues) on WoD live if you remove: PaperDollFrame_UpdateInventoryFixupComplete(self); PaperDollFrame_HideInventoryFixupComplete(self); Code:
-- --------------------------- |
You will want to make sure that font strings are only being created once ever, instead of everytime the frame is shown.
|
Ok, so just focusing on the OnShow portion; I get the children:
Code:
local kids = { PaperDollItemsFrame:GetChildren() }; Code:
for k, child in ipairs(kids) do However I am having trouble with getting it to iterate new text. I am trying to get slotId and then with that get durCur, durMax and refresh everything OnShow with the local function duraOnShow() Code:
local function duraOnShow() Code:
local duraFS = child:CreateFontString("FontString","OVERLAY","GameTooltipText") Code:
duraFS = child:CreateFontString("FontString","OVERLAY","GameTooltipText") To clarify, if I remove the last peice of gear, weapon, then it displays the feet. if I remove the feet it displays the legs, etc, etc. So it works, it is changing the text, it jsut is not allocating each to its own frame. I tried making a table manually as well : Code:
local DCSITEM_SLOT_FRAMES = {CharacterHeadSlot,CharacterNeckSlot,CharacterShoulderSlot, If anyone has time to help me wrangle with this I would appreciate it. Cheers! |
Take a look at Tekkub's tekability:
http://www.wowinterface.com/downloads/info9235 |
I would definitely use the manually created table instead. That's more reliable.
You're just missing a reference to your font strings. When you make the global reference the variable will just be overwritten and refer to whatever you assigned to it last, as you've noticed. What you should do is make a reference on the frames themselves. Do this when creating the frames: Code:
for k, v in ipairs(DCSITEM_SLOT_FRAMES) do Code:
local function duraRefresh() |
Quote:
Thank you so much. I am very new to programming in general let alone lua. Thanks for deciphering my spaghetti too and taking out the time. I will work on this over the weekend and post results or questions. Not that I expect you or anyone to continue to respond, but for other authors so that if they have this issue they can see what was done here. Archived posts has been a huge help to me. Thanks again. Cheers! |
Quote:
Cheers! |
Works perfect. Thanks again everyone. Here is the tentative script:
Code:
-- --------------------------- |
Since you guys are talking about durability, I take it there is no event that fires when an item gains or loses it?
|
No specific event but it's part of taking damage so a health event would probably be the closest.
|
|
Quote:
|
Well, holy shit! Even better! Thanks myrroddin
Ill look into it, but I do not know that I can get rid of OnUpdate becasue when you swap out items on your paper doll the item level of an item doesn't change. There is an event tho, UNIT_INVENTORY_CHANGED that probably can fix that. Thanks for the prompt everyone! ;) |
So doing a /etrace it shows that UPDATE_INVENTORY_DURABILITY fires when you add or remove, change, items on the paper doll. So it appears that registering UNIT_INVENTORY_CHANGED is not needed.
Here is the new script, very nice, no OnUpdate, OnShow, OnHide or timers to worry about. Total durability still seems to be wonky, gotta figure out the math or do something else. Woot, thanks all ;) Code:
-- --------------------------- |
Heh. Don't thank me, I did nothing other than point out my own failing memory. It was Sirann who found your event.
|
Quote:
|
Quote:
|
All times are GMT -6. The time now is 07:03 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI