WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Frame error from Artifact (https://www.wowinterface.com/forums/showthread.php?t=55720)

Uitat 09-05-17 07:10 AM

Frame error from Artifact
 
1x FrameXML\MainMenuBar.lua:125: Usage: local cost = C_ArtifactUI.GetCostForPointAtRank(rank, tier)
[C]: in function `GetCostForPointAtRank'
FrameXML\MainMenuBar.lua:125: in function `MainMenuBar_GetNumArtifactTraitsPurchasableFromXP'
_Deranjata\modules\xpbar\artxp.lua:34: in function <_Deranjata\modules\xpbar\artxp.lua:29>

Locals:
(*temporary) = 38
(*temporary) = nil

Here is the function in its entirety, im really struggling to figure out what is broken i can find no documentation that any of these were changed or discontinued
Lua Code:
  1. derArtifactBar:SetScript("OnEvent", function(self, event, ...)
  2.     if not HasArtifactEquipped() then self:Hide() return end
  3.     self:Show()
  4.  
  5.     local itemID, altItemID, name, icon, totalXP, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
  6.     local numPoints, artifactXP, xpForNextPoint = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP(pointsSpent, totalXP)
  7.     self:SetMinMaxValues(0,xpForNextPoint)
  8.     self:SetValue(artifactXP)
  9.  
  10.     self.Text:SetFormattedText("Artifact XP: %d / %d       +%d Points",artifactXP,xpForNextPoint,numPoints)
  11. end)

Kakjens 09-05-17 09:20 AM

Your best bet is checking the most recent Blizzard Interface files.
Also, pasting to what events the frame derArtifactBar is registered, would be beneficial.

myrroddin 09-05-17 10:22 AM

I don't see C_ArtifactUI.GetCostForPointAtRank in your posted code. Perhaps posting all of your code would shed some light.

Because I don't see it, I am thinking you have tainted the global table with a leaking variable. In which case I highly suggest running your Lua files through this tool.

Uitat 09-05-17 11:34 AM

i think i may have found a way around this

Lua Code:
  1. --Thank you for your help
  2. --SDPhantom
  3. --Phanx
  4. --Fizzlemizz
  5. local AXP_COLOR = { r = 0.6, g = 0.2, b = 0.1 }
  6. --Lets set up the Frame
  7. local derArtifactBar = CreateFrame("Statusbar", "derArtifactBar",artifactFrame)
  8. derArtifactBar:SetPoint("CENTER", 0, 0)
  9. derArtifactBar:SetHeight(18)
  10. derArtifactBar:SetWidth(artifactFrame:GetWidth() * .968)
  11. derArtifactBar:SetStatusBarTexture("Interface\\AddOns\\_Deranjata\\media\\cast\\Waterline")
  12. derArtifactBar:SetStatusBarColor(AXP_COLOR.r, AXP_COLOR.g, AXP_COLOR.b, 0.5)
  13. derArtifactBar:SetBackdrop({
  14.     bgFile =  "Interface\\AddOns\\_Deranjata\\media\\cast\\Lines",
  15.     insets = { left = 1, right = 1, top = 1, bottom = 1 }
  16. })
  17. derArtifactBar:SetBackdropColor(0.1, 0.1, 0.1)
  18. derArtifactBar:SetBackdropBorderColor(0.6, 0.6, 0.6)
  19. --lets clear any text then set out centerpoint
  20. derArtifactBar.Text=derArtifactBar:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  21. derArtifactBar.Text:SetPoint("CENTER")      
  22.  
  23. --Registering out watched events
  24. derArtifactBar:RegisterEvent("PLAYER_ENTERING_WORLD")
  25. derArtifactBar:RegisterEvent("ARTIFACT_XP_UPDATE")
  26. derArtifactBar:RegisterEvent("UNIT_INVENTORY_CHANGED")
  27.  
  28. -- now lets update the position and text on the bar so we can always have accurate info
  29. derArtifactBar:SetScript("OnEvent", function(self, event, ...)
  30.     if not HasArtifactEquipped() then self:Hide() return end
  31.     self:Show()
  32.  
  33.     --local itemID, altItemID, name, icon, xp, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
  34.     local itemID, altItemID, name, icon, xp, pointsSpent, quality, artifactAppearanceID, appearanceModID, itemAppearanceID, altItemAppearanceID, altOnTop, artifactTier = C_ArtifactUI.GetEquippedArtifactInfo()
  35.     local numPoints, artifactXP, xpForNextPoint = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP(pointsSpent, xp, artifactTier) --(pointsSpent, totalXP)
  36.     self:SetMinMaxValues(0,xpForNextPoint)
  37.     self:SetValue(artifactXP)
  38.  
  39.     self.Text:SetFormattedText("Artifact XP: %d / %d       +%d Points",artifactXP,xpForNextPoint,numPoints)
  40. end)

Kakjens 09-05-17 11:34 AM

According to gamepedia, C_ArtifactUI.GetCostForPointAtRank is WoW API function.
Edit. Did you take a break, for, like 6 months from WoW?

Uitat 09-05-17 12:09 PM

Quote:

Originally Posted by Kakjens (Post 325050)
According to gamepedia, C_ArtifactUI.GetCostForPointAtRank is WoW API function.
Edit. Did you take a break, for, like 6 months from WoW?

six months.... maybe more

Fizzlemizz 09-05-17 01:16 PM

Lua Code:
  1. local GetCostForPointAtRank = C_ArtifactUI.GetCostForPointAtRank
  2. local itemID, altItemID, name, icon, artifactXP, pointsSpent, quality, artifactAppearanceID, appearanceModID, itemAppearanceID, altItemAppearanceID, altOnTop, artifactTier = C_ArtifactUI.GetEquippedArtifactInfo()
  3. local pointsAvailable = 0
  4. local xpForNextPoint = GetCostForPointAtRank(pointsSpent + pointsAvailable, artifactTier) or 0
  5. while artifactXP >= xpForNextPoint  do
  6.     artifactXP = artifactXP - xpForNextPoint
  7.     pointsAvailable = pointsAvailable + 1
  8.     xpForNextPoint = GetCostForPointAtRank(pointsSpent + pointsAvailable, artifactTier) or 0
  9. end
  10. local text = floor((artifactXP/xpForNextPoint)*100).."%"

You might want to add a check for artifactXP/xpForNextPoint being less than 0 or greater than 1.

Seerah 09-05-17 01:44 PM

Quote:

Originally Posted by myrroddin (Post 325047)
I don't see C_ArtifactUI.GetCostForPointAtRank in your posted code. Perhaps posting all of your code would shed some light.

Because I don't see it, I am thinking you have tainted the global table with a leaking variable. In which case I highly suggest running your Lua files through this tool.

According to the stack trace, it is called by MainMenuBar_GetNumArtifactTraitsPurchasableFromXP, which the OP is calling.

Uitat 09-06-17 06:39 AM

Quote:

Originally Posted by Fizzlemizz (Post 325053)
Lua Code:
  1. local GetCostForPointAtRank = C_ArtifactUI.GetCostForPointAtRank
  2. local itemID, altItemID, name, icon, artifactXP, pointsSpent, quality, artifactAppearanceID, appearanceModID, itemAppearanceID, altItemAppearanceID, altOnTop, artifactTier = C_ArtifactUI.GetEquippedArtifactInfo()
  3. local pointsAvailable = 0
  4. local xpForNextPoint = GetCostForPointAtRank(pointsSpent + pointsAvailable, artifactTier) or 0
  5. while artifactXP >= xpForNextPoint  do
  6.     artifactXP = artifactXP - xpForNextPoint
  7.     pointsAvailable = pointsAvailable + 1
  8.     xpForNextPoint = GetCostForPointAtRank(pointsSpent + pointsAvailable, artifactTier) or 0
  9. end
  10. local text = floor((artifactXP/xpForNextPoint)*100).."%"

You might want to add a check for artifactXP/xpForNextPoint being less than 0 or greater than 1.

in a wierd little way i do that here
Lua Code:
  1. if not HasArtifactEquipped() then self:Hide() return end

Fizzlemizz 09-06-17 09:31 AM

Quote:

Originally Posted by Uitat (Post 325058)
in a wierd little way i do that here
Lua Code:
  1. if not HasArtifactEquipped() then self:Hide() return end

I actually have that before the code I quoted which is just getting the current AP level plus pointsAvailable if you have "filled the bar" multiple times before using the forge, which is quite easy with new 110s (or atl least was pre 7.3)


All times are GMT -6. The time now is 09:31 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI