Hello,
First of all i know that some people previously asked some tips about the same problem i have. So i would say that i already try the way they solve their problems but it didn"t worked for me.
I have a lua code who is supposed to make a bar spawn somewhere on my screen IG. All my problem is about the function "SetStatusBarTexture" so i traced it :
Lua Code:
local BarreDeFureurEpaisseur = 10
local BarreDeFureurLongueur = 100
local CheminImageBarre = 'Interface\\AddOns\\ATH_Demon_Hunter\\textures\\barreDeFureur'
local function F_ApparitionBarreFureur ()
local BarreDeFureur = CreateFrame("StatusBar", "BarreDeFureur", UIParent)
print("1")
local a = BarreDeFureur:SetStatusBarTexture(CheminImageBarre)
if (a == nil) then print("!!!Texture for bar not load!!!") end
BarreDeFureur:SetLenght(BarreDeFureurLongueur)
BarreDeFureur:SetHeight(BarreDeFureurEpaisseur)
BarreDeFureur:SetHitRectInsets(2, 2, 2, 2)
BarreDeFureur:SetStatusBarColor(0, 1, 0)
BarreDeFureur:SetFillStyle("STANDARD")
BarreDeFureur:SetMinMaxValues(0, 100)
BarreDeFureur:SetPoint("CENTER", 0, 10)
BarreDeFureur:SetShown(true)
end
The message "!!!Texture for bar not load!!!" appared each time even if entirely closed WoW.
i also "tested my test" by puting the return of CreateFrame in a first (and it returned a table as expected, the "equivalent of pointer" in lua). I put that test because the bar never appeared.
This is not the entir code, i posted just the part which have trouble (and i tested the rest of the code with debug trace to be sure that the issue come from here.
Most of the time this error is caused by the path which is not the good one. So there is the absolute path of the files that i try to use (on windows 10) :
Lua Code:
C:\Program Files (x86)\World of Warcraft\_retail_\Interface\AddOns\ATH_Demon_Hunter\textures\barreDeFureur.blp
C:\Program Files (x86)\World of Warcraft\_retail_\Interface\AddOns\ATH_Demon_Hunter\textures\barreDeFureur.png
note : The AddOns folder was primary named Addons, and i changed it to see if this have change something. It didn't change anything but i let it like this.
And i try those different path, none of the worked (the a is still equal to nil) :
Lua Code:
local CheminImageBarre = 'Interface\\AddOns\\ATH_Demon_Hunter\\textures\\barreDeFureur'
local CheminImageBarre = "Interface\\AddOns\\ATH_Demon_Hunter\\textures\\barreDeFureur"
local CheminImageBarre = 'Interface//AddOns//ATH_Demon_Hunter//textures//barreDeFureur'
local CheminImageBarre = "Interface//AddOns//ATH_Demon_Hunter//textures//barreDeFureur"
local CheminImageBarre = 'Interface\\Addons\\ATH_Demon_Hunter\\textures\\barreDeFureur'
local CheminImageBarre = "Interface\\Addons\\ATH_Demon_Hunter\\textures\\barreDeFureur"
local CheminImageBarre = 'Interface//Addons//ATH_Demon_Hunter//textures//barreDeFureur'
local CheminImageBarre = "Interface//Addons//ATH_Demon_Hunter//textures//barreDeFureur"
local CheminImageBarre = 'Interface/AddOns/ATH_Demon_Hunter/textures/barreDeFureur'
local CheminImageBarre = "Interface/AddOns/ATH_Demon_Hunter/textures/barreDeFureur"
local CheminImageBarre = 'Interface/Addons/ATH_Demon_Hunter/textures/barreDeFureur'
local CheminImageBarre = "Interface/Addons/ATH_Demon_Hunter/textures/barreDeFureur"
local CheminImageBarre = 'Interface\\AddOns\\ATH_Demon_Hunter\\textures\\barreDeFureur.blp'
local CheminImageBarre = "Interface\\AddOns\\ATH_Demon_Hunter\\textures\\barreDeFureur.blp"
local CheminImageBarre = 'Interface//AddOns//ATH_Demon_Hunter//textures//barreDeFureur.blp'
local CheminImageBarre = "Interface//AddOns//ATH_Demon_Hunter//textures//barreDeFureur.blp"
local CheminImageBarre = 'Interface\\Addons\\ATH_Demon_Hunter\\textures\\barreDeFureur.blp'
local CheminImageBarre = "Interface\\Addons\\ATH_Demon_Hunter\\textures\\barreDeFureur.blp"
local CheminImageBarre = 'Interface//Addons//ATH_Demon_Hunter//textures//barreDeFureur.blp'
local CheminImageBarre = "Interface//Addons//ATH_Demon_Hunter//textures//barreDeFureur.blp"
local CheminImageBarre = 'Interface/AddOns/ATH_Demon_Hunter/textures/barreDeFureur.blp'
local CheminImageBarre = "Interface/AddOns/ATH_Demon_Hunter/textures/barreDeFureur.blp"
local CheminImageBarre = 'Interface/Addons/ATH_Demon_Hunter/textures/barreDeFureur.blp'
local CheminImageBarre = "Interface/Addons/ATH_Demon_Hunter/textures/barreDeFureur.blp"
local CheminImageBarre = 'Interface\\AddOns\\ATH_Demon_Hunter\\textures\\barreDeFureur.png'
local CheminImageBarre = "Interface\\AddOns\\ATH_Demon_Hunter\\textures\\barreDeFureur.png"
local CheminImageBarre = 'Interface//AddOns//ATH_Demon_Hunter//textures//barreDeFureur.png'
local CheminImageBarre = "Interface//AddOns//ATH_Demon_Hunter//textures//barreDeFureur.png"
local CheminImageBarre = 'Interface\\Addons\\ATH_Demon_Hunter\\textures\\barreDeFureur.png'
local CheminImageBarre = "Interface\\Addons\\ATH_Demon_Hunter\\textures\\barreDeFureur.png"
local CheminImageBarre = 'Interface//Addons//ATH_Demon_Hunter//textures//barreDeFureur.png'
local CheminImageBarre = "Interface//Addons//ATH_Demon_Hunter//textures//barreDeFureur.png"
local CheminImageBarre = 'Interface/AddOns/ATH_Demon_Hunter/textures/barreDeFureur.png'
local CheminImageBarre = "Interface/AddOns/ATH_Demon_Hunter/textures/barreDeFureur.png"
local CheminImageBarre = 'Interface/Addons/ATH_Demon_Hunter/textures/barreDeFureur.png'
local CheminImageBarre = "Interface/Addons/ATH_Demon_Hunter/textures/barreDeFureur.png"
You may ask "why try all those folder ?" and i would respond "I don't know who to fixe this because i don't understand what's happening so i try everythin i thinked about"
You may also say "some of those path would not work anyway" and i just generated all the possible combination it would be possible to write the path with...
So if someone have an idea...
Thank you for the one who'll take the time to read this
Edit :
In case it help here's the complete code :
Lua Code:
-----------------------------------------------------------------------------------------------------------
-- var
-----------------------------------------------------------------------------------------------------------
local DebugActif = 1
local playerClass = select(2, UnitClass("player"))
local BarreDeFureurEpaisseur = 10
local BarreDeFureurLongueur = 100
local FureurMaxDuJoueur = 100
local CheminImageBarre = 'Interface\\Addons\\ATH_Demon_Hunter\\textures\\barreDeFureur'
-----------------------------------------------------------------------------------------------------------
-- Frames
-----------------------------------------------------------------------------------------------------------
local InitFrame = CreateFrame ("Frame", "InitFrame")
InitFrame : RegisterEvent ("PLAYER_ENTERING_WORLD")
InitFrame : RegisterEvent ("ADDON_LOADED")
local CombatFrame = CreateFrame ("Frame", "CombatFrame")
CombatFrame : RegisterUnitEvent("UNIT_POWER_UPDATE", "player")
CombatFrame : RegisterUnitEvent("UNIT_HEALTH", "player")
CombatFrame : RegisterUnitEvent("UNIT_MAXHEALTH", "player")
-----------------------------------------------------------------------------------------------------------
-- functions
-----------------------------------------------------------------------------------------------------------
function PrintDebug (texte)
if DebugActif == 1 then print(texte.."\n") end
end
local function F_ApparitionBarreFureur ()
local BarreDeFureur = CreateFrame("StatusBar", "BarreDeFureur", UIParent)
PrintDebug("1")
local a = BarreDeFureur:SetStatusBarTexture(CheminImageBarre)
if (a == nil) then PrintDebug("!!!Texture for bar not load!!!") end
BarreDeFureur:SetLenght(BarreDeFureurLongueur)
BarreDeFureur:SetHeight(BarreDeFureurEpaisseur)
BarreDeFureur:SetHitRectInsets(2, 2, 2, 2)
BarreDeFureur:SetStatusBarColor(0, 1, 0)
BarreDeFureur:SetFillStyle("STANDARD")
BarreDeFureur:SetMinMaxValues(0, 100)
BarreDeFureur:SetPoint("CENTER", 0, 10)
BarreDeFureur:SetShown(true)
PrintDebug ("fin F_ApparitionBarreFureur")
end
local function F_GetFureurActuelle ()
local FureurActuel = UnitPower("player", SPELL_POWER_PAIN)
local PourcentageDeFureur = FureurActuel/FureurMaxDuJoueur*100
BarreDeFureur:SetStatusBarColor(1, PourcentageDeFureur/100, 0)
return math.floor(PourcentageDeFureur + 0.5)
end
local function F_InitialisationRessources ()
F_ApparitionBarreFureur()
F_GetFureurActuelle()
end
local function F_CBInit(self, event, ...)
if (event == "PLAYER_ENTERING_WORLD") then
PrintDebug ("PLAYER_ENTERING_WORLD fired")
F_InitialisationRessources()
PrintDebug ("fin d'appel de InitFrame")
end
end
local function F_CBCombat (self, event, ...)
if (event == "UNIT_POWER_UPDATE") then
PrintDebug ("UNIT_POWER_UPDATE fired")
F_GetFureurActuelle()
PrintDebug ("fin d'appel de F_GetFureurActuelle")
end
end
-----------------------------------------------------------------------------------------------------------
-- Scripts
-----------------------------------------------------------------------------------------------------------
InitFrame : SetScript ("OnEvent", F_CBInit)
CombatFrame : SetScript ("OnEvent", F_CBCombat)