I have my addon working. The only problem I have is I want to make it where, when the user moves the frame around on the screen to a spot they like it at it will save to that location. This way my addon doesn't pop up in the middle of the screen every single time the reload ui or log into the game. If you can please be as detailed as possible because I'm very new to coding and I have only built this addon from using tutorial code.
Here Is my current LUA
Lua Code:
function MyAddonRollDice()
local num = math.random(1,100)
return num
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
EVENT_MANAGER:RegisterForEvent("LootDice", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
Here is my current XML
Lua Code:
<GuiXml>
<Controls>
<TopLevelControl name="LootDice" mouseEnabled="true" movable="true">
<Dimensions x="150" y="42" />
<Anchor point="CENTER" />
<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>