You may have seen me post a thread about saving a frame. I since then have tried a few different ways. Someone was helping me but there offline now. If you can help me just post in the thread. I'm going to give my xml and lua I have so far. If you can copy the code fix it post it back. I have simply tried to make the frame save to the last location the user puts it in. If you fix the code please leave comments in the code explaining a little of how it fixes it. Before you say anything I know my code is very messy but the only way I'm learning is from playing around with it since there is only like one tutorial for eso lua and know video tutorials. I'm brand new to coding, before this only code I knew was html.
XML
Lua Code:
<GuiXml>
<Controls>
<TopLevelControl name="LootDice" mouseEnabled="true" movable="true">
<Dimensions x="150" y="42" />
<OnMouseDown>
Roll = MyAddonRollDice()
LootDiceRoll:SetText(Roll)
</OnMouseDown>
<Controls>
<Backdrop name="$(parent)BG" inherits="ZO_ThinBackdrop" />
<Label name="$(parent)Roll" font="ZoFontWindowTitle" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" horizontalAlignment="CENTER" text="LootDice" >
<AnchorFill />
</Label>
</Controls>
</TopLevelControl>
</Controls>
</GuiXml>
LUA
Lua Code:
RollVars.Defaults = {
["hideRoll"] = false,
["Roll"] = {
["offsetx"] = 0,
["offsety"] = 0,
["point"] = TOPLEFT,
["relPoint"] = TOPLEFT,
},
}
function MyAddonRollDice()
local num = math.random(1,100)
return num
end
function OnMoveStopRoll()
_, RollVars.SV.Dice.point, _, RollVars.SV.roll.relPoint, RollVars.SV.roll.offsetx, RollVars.SV.roll.offsety = Roll:GetAnchor(0)
end
local function OnAddOnLoaded(eventCode, addon)
if addon == "LootDice" then
LootDice_SavedVariables = { "LootDice V 1.0", isAddOnEnabled = true}
d("LootDice_SavedVariables.isAddOnEnabled = "..tostring(LootDice_SavedVariables.isAddOnEnabled))
end
end
Roll:SetHandler("OnMoveStop", OnMoveStopRoll)
Roll:SetAnchor(RollVars.SV.roll.point, nil, Roll.SV.roll.relPoint, Roll.SV.roll.offsetx, RollVars.SV.roll.offsety)
RollVars.SV = ZO_SavedVars:New( "Roll_Variables" , 2 , nil , RollVars.Defaults , nil )
EVENT_MANAGER:RegisterForEvent("LootDice", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
TXT - I don't think anything is messed up here but just wanted to give you all info.
Lua Code:
## Title: LootDice - By Zireko
## APIVersion: 100003
## Description: A simple Loot Dice for group runs.
## Version: 1.0
## SavedVariables: LootDice_SavedVariables
LootDice.lua
LootDice.xml