Thread Tools Display Modes
05-07-23, 02:38 PM   #1
redlemon
A Murloc Raider
Join Date: May 2023
Posts: 5
AceDB-3.0 dont save...

Hi !

Il have a error on use SaveProfile():

Code:
Message: Interface/AddOns/EnemyUnitFrame/mainV5.lua:81: attempt to call method 'SaveProfile' (a nil value)
Time: Sun May  7 22:20:45 2023
My code :

https://pastebin.com/YVdpZeZL

my Toc file :

Code:
## Interface: 100100
## Title:Enemy Unit Frame
## Author: Baudson JF
## Version: 1.0
## SavedVariables: EnemyUnitFrame
## IconTexture: Interface\Icons\Ability_Marksmanship

main.xml
thank for your help
  Reply With Quote
05-07-23, 03:42 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
SaveProfile is not an AceDB-3.0 method.

It might belong to one of the other Ace components that you're not using or maybe you assumed because there's a DeleteProfile method.

WoW SavedVariables are automatically saved to disk then you logout/exit or /reload. There is no other mechanism for forcing a save.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
05-07-23, 05:39 PM   #3
redlemon
A Murloc Raider
Join Date: May 2023
Posts: 5
Hi,

thx for your reponse.

OK, i understand. The position of my frame ist no save.
  Reply With Quote
05-07-23, 06:19 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
From the code, I'm guessing you mean Euf_ConfigFrame

Lua Code:
  1. Euf_ConfigFrame:SetScript("OnDragStop", function(self) Euf_ConfigFrame:StopMovingOrSizing() end)

This just stops the the dragging of the frame. Once this is done you need to save the new position of the frame. You could use something like LibWindow you could do it manually by making some changes like:
The default positioning: (Small Note: Changing the defaults table won't change the defaults already saved on disk so you will need to remove that file before the new ones will take effect or the frame won't show up on screen)

Lua Code:
  1. local defaults = {
  2.     profile = {
  3.         position = {
  4.             point = "CENTER",
  5.             topoint = "CENTER",
  6.             x = 50,
  7.             y = 50
  8.         },
  9.         Shown = true,
  10.         Castbar = true
  11.     }
  12. }

Which means you would change setting the initial frame position to:
Lua Code:
  1. Euf_ConfigFrame:SetPoint(dataPlayer.position.point, UIParent, dataPlayer.position.topoint, dataPlayer.position.x, dataPlayer.position.y)

and finally change the OnDragStop to:
Lua Code:
  1. Euf_ConfigFrame:SetScript("OnDragStop", function(self)
  2.     self:StopMovingOrSizing()
  3.     local p, r, t, x, y = self:GetPoint(1)
  4.     dataPlayer.position.point = p
  5.     dataPlayer.position.topoint = t
  6.     dataPlayer.position.x = x
  7.     dataPlayer.position.y = y
  8. end)

The p and t (point and topoint) returned by GetPoint() are relative to the frames position on screen so depending on that, they will change.

This probably won't save the position perfectly, LibWindow makes it pretty effortless.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-08-23 at 12:27 AM.
  Reply With Quote
05-08-23, 05:12 AM   #5
redlemon
A Murloc Raider
Join Date: May 2023
Posts: 5
Thank you very much.
Even if you didn't tell me directly where my mistakes are, you showed me the way to find them.
Thank you also for your optimization.
The mistakes were rookie mistakes. (I have only been programming for 15 days).
So, effectively, when using AceDB, there is no loading or saving procedure. It's automatic. So I fired my Load_DB and Save_DB. In addition, I made the mistake of recreating my Config_Frame each time it was used, so it returned to its default value each time. Now I create it once and after that I use Hide() and Show() and it works perfectly.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » AceDB-3.0 dont save...


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