Quantcast Frame error from Artifact - WoWInterface
Thread Tools Display Modes
09-05-17, 07:10 AM   #1
Uitat
A Flamescale Wyrmkin
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 141
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)
__________________
  Reply With Quote
09-05-17, 09:20 AM   #2
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
Your best bet is checking the most recent Blizzard Interface files.
Also, pasting to what events the frame derArtifactBar is registered, would be beneficial.

Last edited by Kakjens : 09-05-17 at 09:27 AM.
  Reply With Quote
09-05-17, 10:22 AM   #3
myrroddin
A Molten Giant
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 997
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.
  Reply With Quote
09-05-17, 11:34 AM   #4
Uitat
A Flamescale Wyrmkin
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 141
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)
__________________
  Reply With Quote
09-05-17, 11:34 AM   #5
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
According to gamepedia, C_ArtifactUI.GetCostForPointAtRank is WoW API function.
Edit. Did you take a break, for, like 6 months from WoW?

Last edited by Kakjens : 09-05-17 at 11:41 AM.
  Reply With Quote
09-05-17, 12:09 PM   #6
Uitat
A Flamescale Wyrmkin
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 141
Originally Posted by Kakjens View Post
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
__________________
  Reply With Quote
09-05-17, 01:16 PM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,106
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.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-05-17 at 02:08 PM.
  Reply With Quote
09-05-17, 01:44 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,598
Originally Posted by myrroddin View Post
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.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-06-17, 06:39 AM   #9
Uitat
A Flamescale Wyrmkin
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 141
Originally Posted by Fizzlemizz View Post
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
__________________
  Reply With Quote
09-06-17, 09:31 AM   #10
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,106
Originally Posted by Uitat View Post
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)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Frame error from Artifact

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off