artifact xp bar
this is my error, and i dont know how to fix it
----------------------------------------------------------------------------------------------------- 40x _Deranjata\modules\xpbar\artxp.lua:35: attempt to call global 'SetValue' (a nil value) _Deranjata\modules\xpbar\artxp.lua:35: in function <_Deranjata\modules\xpbar\artxp.lua:22> Locals: self = derArtifactBar { 0 = <userdata> } event = "UNIT_INVENTORY_CHANGED" showArtifact = true itemID = 128866 altItemID = 128867 name = "Truthguard" icon = 1272527 totalXP = 100 pointsSpent = 0 numPoints = 1 artifactXP = 0 xpForNextPoint = 300 (*temporary) = nil (*temporary) = derArtifactBar { 0 = <userdata> } (*temporary) = 0 (*temporary) = "attempt to call global 'SetValue' (a nil value)" ------------------------------------------------------------------------ here is my code Lua Code:
SetValue(self, artifactXP/xpForNextPoint) is throwing an error for derArtifactBar:SetScript("OnEvent", function(self, event, ...) |
SetValue does not exist as a global, it is only inherited in frames. Change SetValue to self:SetValue and you should be fine.
|
And after doing that, the "self" you're passing it as the first argument needs to be removed, too:
SetValue(self, ...) => self:SetValue(...) |
i dont know
i dont know i may have to rebuild this, even with your guy's help, its not working
|
ok i have no errors but also have no status
1 Attachment(s)
im using Dominos to show as reference...
what i am expecting to happen here ... in the box with the stripes is what you se just above it(dominos artifact bar) what im getting is nothing, there is no errors, but also no info... ---- See Attached Thumbnail below ---- code Lua Code:
|
it doesn't have a derArtifactBar:SetStatusBarTexture(...) to draw.
|
What are the min/max values on your statusbar?
|
Quote:
|
Quote:
|
Quote:
i thought thats what i was doing with this self:SetValue(artifactXP/xpForNextPoint) |
No, that sets the CURRENT value of your statusbar, which should be a number somewhere between the min and max values.
http://wowprogramming.com/docs/widgets/StatusBar |
Quote:
Code:
self:SetMinMaxValues(0,xpForNextPoint) |
thank you all for the info, it physically works now just the text formatting
this is my formatting for the standard xp/rep bars, how would i implement this here, as i am unable to fully comprehend the API for the artifact bars i am still having issues Lua Code:
would i change out to Lua Code:
|
You should just use those values directly instead of wasting resources copying them into more variables.
Code:
text:SetFormattedText("XP: %d / %d ",artifactXP,xpForNextPoint) |
ok in end
ok so at the end of this all it works fine now and i am mostly happy. now i just want to have a + then number for levels accumulated on the bar before spending, i can figure that out at some time , for now i am just glad to have this
Lua Code:
|
solved
got the points added by doing....
text:SetFormattedText("Artifact XP: %d / %d + %d",artifactXP,xpForNextPoint, numPoints) result on bar.... Artifact XP: 185/375 +3 id say im happy with this!!! |
One last problem. When aryifact xp is added to my bar i get an aditional text layer over the first layer. Can someone test the code and see if you get the same result?
|
You are creating derArtifactBar multiple times. Once at load and again whenever any of those 3 events fire. Same goes with the fontstring - a new fontstring is being created every time an event fires.
|
Quote:
sorry sending from my S7 Android |
You need to move these lines out of the event handler. Probably to the main scope.
Code:
local bar = CreateFrame("StatusBar", nil, derArtifactBar) |
All times are GMT -6. The time now is 09:24 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI