View Single Post
11-04-08, 05:03 PM   #2
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
I'm still new to this, but I think I have the gist of it.

First, you need to enable the SV in the TOC (shown in that tutorial).
Code:
SavedVariables: TESTDB
or
SavedVariablesPerCharacter: TESTDB
Second, you need to set up the default variables to save.
Example:
Code:
TESTDB = {
    variable1 = true;
    variable2 = true;
    variable3 = true;
    scale = 1.5;
    parent = "UIParent";
    point = "CENTER";
    parentPoint = "CENTER";
    x = 0;
    y = -100;
};
Third, you need to set it up so that you load the saved variables.
Example:
Code:
function FRAME_Update()
    FRAME:ClearAllPoints()
    FRAME:SetPoint(TESTDB.point, TESTDB.parent, TESTDB.parentPoint, TESTDB.x, TESTDB.y)
    FRAME:SetScale(RuneMoverDB.scale);
    if (FRAME:IsMouseEnabled()) then
        TESTDB.point, relativeTo, TESTDB.parentPoint, TESTDB.x, TESTDB.y = FRAME:GetPoint();
    end
end
(NOTE: This will vary drastically based on what variables you are looking to save. In this example, I have a frame's position saved and it's scale.)

Lastly, you need to update the saved variables if the user wishes to change them.

This is the basics of it. I hope this helped you a little. I am sorry if I have said something wrong. I am still really new
__________________
Never be satisfied with satisfactory.

Last edited by Cralor : 11-04-08 at 05:07 PM.
  Reply With Quote