custom ui + isvalid()
Posted: Sun Aug 11, 2013 10:27 am
I am not sure whether this is a bug or I am just stupid, but here is the problem.
I have this code in the onTick-event:
When I start a new game glob.blueprints.overseer.count + glob.blueprints.miningsites.count == 0
and everything works fine. Later on both variables can be increased and decreased, but each are always >= 0. If at least one variable > 0 everything works fine as well.
But if both are 0 again the UI should be destroyed, instead I got this error:
where line 111 = "if UI.miningsiteOverseerFrame.isvalid() then UI.miningsiteOverseerFrame.destroy() end"
So how can I solve that problem?
I have this code in the onTick-event:
Code: Select all
if (glob.blueprints.overseer.count + glob.blueprints.miningsites.count) > 0 then
if ((event.tick % 300) == 0) and (glob.blueprints.overseer.closed == false) then
if UI.miningsiteOverseerFrame ~= nil then
if UI.miningsiteOverseerFrame.isvalid() then UI.miningsiteOverseerFrame.destroy() end
end
UI.miningsiteOverseer_UI_creation()
end
else
if UI.miningsiteOverseerFrame ~= nil then
if UI.miningsiteOverseerFrame.isvalid() then UI.miningsiteOverseerFrame.destroy() end
end
end
and everything works fine. Later on both variables can be increased and decreased, but each are always >= 0. If at least one variable > 0 everything works fine as well.
But if both are 0 again the UI should be destroyed, instead I got this error:
Code: Select all
111: LuaGuiElementAPI call when gui button does not exist
So how can I solve that problem?