When I set it to local function instead of just function it gives and error but when its a global it works for some odd reason. I'm testing and moving code all around but here is the entire code lua, xml, and txt. So you can see exactly what I'm working with.
LUA - I have the save part of the code commented out so I could test the local.
Lua Code:
local function RollDice()
local num = math.random(1,100)
return num
end
--[[
LootDice:SetHandler( "OnMoveStop", function()
local function OnAddOnLoaded(eventCode, LootDice)
if(LootDice == "<<LootDice>>") then
local savedVars = ZO_SavedVars:New(LootDice_SavedVariables, 1)
end
end)
EVENT_MANAGER:RegisterForEvent("LootDice", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
]]--
XML
Lua Code:
<GuiXml>
<Controls>
<TopLevelControl name="LootDice" mouseEnabled="true" movable="true">
<Dimensions x="150" y="42" />
<Anchor point="CENTER" />
<OnMouseDown>
Roll = RollDice()
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>
TXT
Lua Code:
## Title: LootDice - By Rylew
## APIVersion: 100003
## Description: A simple Loot Dice for group runs.
## Version: 1.0
## SavedVariables: LootDice_SavedVariables
LootDice.lua
LootDice.xml