ralke
(҂ ͠❛ ෴ ͡❛)ᕤ
Hi! I wonder if someone can help me at this. I have a weird error on conditions, OTClient. I use a custom inventory panel that holds player conditions, buttons, etc. And the toggle function of the condition is not working properly. When I log in PZ for example, it doesn't show the icon of protection zone. But as long I get out, I get the protection zone icon turns on (it's like conditions are reversed).
Without condition icon inside PZ.
With condition icon outside PZ
As I see the toggle function is wrong onLogin, since the condition is activated as soon is "triggered" instead of when player stands on special tile.
Please give me a hand with this! Here is the functions and I have attached a .rar file with the module.
Thanks in advance!
After more test found that this only happens with some characters, other characters have their conditions working well. How is this possible? Is this related to cache somehow? Any help is appreciated. Regards!
Fixed! I was missing
Without condition icon inside PZ.
With condition icon outside PZ
As I see the toggle function is wrong onLogin, since the condition is activated as soon is "triggered" instead of when player stands on special tile.
Please give me a hand with this! Here is the functions and I have attached a .rar file with the module.
Lua:
function toggleIcon(bitChanged)
local content = inventoryWindow:recursiveGetChildById('conditionPanel')
local icon = content:getChildById(Icons[bitChanged].id)
if icon then
icon:destroy()
else
icon = loadIcon(bitChanged)
icon:setParent(content)
end
end
function loadIcon(bitChanged)
local icon = g_ui.createWidget('ConditionWidget', content)
icon:setId(Icons[bitChanged].id)
icon:setImageSource(Icons[bitChanged].path)
icon:setTooltip(Icons[bitChanged].tooltip)
return icon
end
function onStatesChange(localPlayer, now, old)
if now == old then
return
end
local bitsChanged = bit.bxor(now, old)
for i = 1, 32 do
local pow = math.pow(2, i - 1)
if pow > bitsChanged then
break
end
local bitChanged = bit.band(bitsChanged, pow)
if bitChanged ~= 0 then
toggleIcon(bitChanged)
end
end
end
Thanks in advance!
Post automatically merged:
After more test found that this only happens with some characters, other characters have their conditions working well. How is this possible? Is this related to cache somehow? Any help is appreciated. Regards!
Post automatically merged:
Fixed! I was missing
Lua:
function offline()
inventoryWindow:setParent(nil, true)
inventoryWindow:recursiveGetChildById('conditionPanel'):destroyChildren()
end
Attachments
-
game_inventory.rar5.1 KB · Views: 9 · VirusTotal
Last edited: