Thread Tools Display Modes
04/26/14, 03:57 PM   #1
zireko
 
zireko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 63
Launched LootDice already. I'm just trying to fix the save frame code.

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:
  1. <GuiXml>
  2.     <Controls>
  3.         <TopLevelControl name="LootDice" mouseEnabled="true" movable="true">
  4.             <Dimensions x="150" y="42" />
  5.                                    
  6.             <OnMouseDown>
  7.                 Roll = MyAddonRollDice()
  8.                 LootDiceRoll:SetText(Roll)
  9.             </OnMouseDown>
  10.                        
  11.             <Controls>
  12.                 <Backdrop name="$(parent)BG" inherits="ZO_ThinBackdrop" />
  13.                 <Label name="$(parent)Roll" font="ZoFontWindowTitle" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" horizontalAlignment="CENTER" text="LootDice" >
  14.                     <AnchorFill />                     
  15.                 </Label>
  16.             </Controls>
  17.         </TopLevelControl>
  18.     </Controls>
  19. </GuiXml>

LUA

Lua Code:
  1. RollVars.Defaults = {
  2.     ["hideRoll"] = false,
  3.     ["Roll"] = {
  4.         ["offsetx"] = 0,
  5.         ["offsety"] = 0,
  6.         ["point"] = TOPLEFT,
  7.         ["relPoint"] = TOPLEFT,
  8.         },
  9. }
  10.  
  11. function MyAddonRollDice()
  12.     local num = math.random(1,100)
  13.     return num
  14. end
  15.  
  16. function OnMoveStopRoll()
  17.     _, RollVars.SV.Dice.point, _, RollVars.SV.roll.relPoint, RollVars.SV.roll.offsetx, RollVars.SV.roll.offsety = Roll:GetAnchor(0)
  18. end
  19.  
  20. local function OnAddOnLoaded(eventCode, addon)
  21.     if addon == "LootDice" then
  22.         LootDice_SavedVariables = { "LootDice V 1.0", isAddOnEnabled = true}
  23.         d("LootDice_SavedVariables.isAddOnEnabled = "..tostring(LootDice_SavedVariables.isAddOnEnabled))
  24.     end
  25. end
  26.  
  27. Roll:SetHandler("OnMoveStop", OnMoveStopRoll)
  28.  
  29. Roll:SetAnchor(RollVars.SV.roll.point, nil, Roll.SV.roll.relPoint, Roll.SV.roll.offsetx, RollVars.SV.roll.offsety)
  30.  
  31. RollVars.SV = ZO_SavedVars:New( "Roll_Variables" , 2 , nil , RollVars.Defaults , nil )
  32.  
  33. 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:
  1. ## Title: LootDice - By Zireko
  2. ## APIVersion: 100003
  3. ## Description: A simple Loot Dice for group runs.
  4. ## Version: 1.0
  5. ## SavedVariables: LootDice_SavedVariables
  6.  
  7. LootDice.lua
  8. LootDice.xml
  Reply With Quote
04/26/14, 04:32 PM   #2
zireko
 
zireko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 63
O btw if you all are wondering why I'm asking if anyone wants to do this it's because I'm taking a little break for a day or two. My heads hurting from all the learning lol and I wana play some LOL.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Launched LootDice already. I'm just trying to fix the save frame code.


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off