Ok, thanks again, I'll give it a try this way.
After my tries:
I'm not able to prehook the function SetMode of ZO_Smithing or SMITHING.
I've tried it in several ways, searched for aliases to use. But there are none as it seems.
The way I know it should work does nothing:
Lua Code:
ZO_PreHook("ZO_Smithing", "SetMode", function(mode)
...
end)
Ok, my fault. Or let's say another feature
I forgot to remove the "" around ZO_Smithing :-(
And the function needs another parameter before mode (holding the SMITHING object).
Correct call:
Lua Code:
--Prehook the smithing function SetMode() which gets executed as the smithing tabs are changed
ZO_PreHook(ZO_Smithing, "SetMode", function(smithing_obj, mode)
d("[ZO_Smithing:SetMode] Mode: " .. tostring(mode), true)
if mode == SMITHING_MODE_REFINMENT then
d("REFINEMENT")
elseif mode == SMITHING_MODE_CREATION then
d("CREATION")
elseif mode == SMITHING_MODE_IMPROVEMENT then
d("IMPROVEMENT")
elseif mode == SMITHING_MODE_DECONSTRUCTION then
d("DECONSTRUCTION")
elseif mode == SMITHING_MODE_RESEARCH then
d("RESEARCH")
else
d("SMITHING")
end
return false
end)