Once again remove <Anchor> tags from both <TopLevelControl> in your .xml file. You are setting them in the lua code.
The problem is with control names:
Code:
<TopLevelControl name="Pure" mouseEnabled="true" movable="true" hidden="false">
...
<Label name="$(parent)Time" font="ZoFontGame" movable="true" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="">
...
<TopLevelControl name="PureG" mouseEnabled="true" movable="true" hidden="false">
...
<Label name="$(parent)old" font="ZoFontGame" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="">
Your TopLevelControls are named "Pure" and "PureG" but in the code you are refering to Labels (named "PureTime" and "PureGold"):
Lua Code:
PureGold:SetHandler("OnMoveStop", OnMoveStopGold)
PureTime:SetHandler("OnMoveStop", OnMoveStopTime)
...
PureGold:SetAnchor(PureVars.SV.gold.point, nil, PureVars.SV.gold.relPoint, PureVars.SV.gold.offsetx, PureVars.SV.gold.offsety)
PureTime:SetAnchor(PureVars.SV.clock.point, nil, PureVars.SV.clock.relPoint, PureVars.SV.clock.offsetx, PureVars.SV.clock.offsety)
...
function OnMoveStopGold()
_, PureVars.SV.gold.point, _, PureVars.SV.gold.relPoint, PureVars.SV.gold.offsetx, PureVars.SV.gold.offsety = PureGold:GetAnchor(0)
end
function OnMoveStopTime()
_, PureVars.SV.clock.point, _, PureVars.SV.clock.relPoint, PureVars.SV.clock.offsetx, PureVars.SV.clock.offsety = PureTime:GetAnchor(0)
end
Instead this should look like this:
Lua Code:
PureG:SetHandler("OnMoveStop", OnMoveStopGold)
Pure:SetHandler("OnMoveStop", OnMoveStopTime)
...
PureG:SetAnchor(PureVars.SV.gold.point, nil, PureVars.SV.gold.relPoint, PureVars.SV.gold.offsetx, PureVars.SV.gold.offsety)
Pure:SetAnchor(PureVars.SV.clock.point, nil, PureVars.SV.clock.relPoint, PureVars.SV.clock.offsetx, PureVars.SV.clock.offsety)
...
function OnMoveStopGold()
_, PureVars.SV.gold.point, _, PureVars.SV.gold.relPoint, PureVars.SV.gold.offsetx, PureVars.SV.gold.offsety = PureG:GetAnchor(0)
end
function OnMoveStopTime()
_, PureVars.SV.clock.point, _, PureVars.SV.clock.relPoint, PureVars.SV.clock.offsetx, PureVars.SV.clock.offsety = Pure:GetAnchor(0)
end
You should review your code because there are other places where you operate on wrong controls. For example:
Lua Code:
PureGold:SetHidden(checkbox)
This will show/hide the Label control but you want to show/hide TopLevelControl instead.
For a change this is your good code:
Lua Code:
PureTime:SetText(string.format("%d:%02d %s", hours, minutes, tod) )
...
PureGold:SetText(string.format("GOLD: %d", currGold) )
Hope this helps