Thread Tools Display Modes
10-26-09, 06:04 AM   #1
Malecden
A Murloc Raider
 
Malecden's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 6
Saved Variable Issue

Hello, I'm having a bit of an issue saving a variable between sessions. Currently I have four variables set to save in the .toc file. However, only the first three seem to be saving. The value I'm having trouble with is always either a 1 or a 2 integer value, but always seems to return to 1 on load as if it were nil. I've even checked the value of it before reloading the UI and after the reload it returns to its default value as if it were a nil value on load. Is there something I could be missing? Thanks in advance.
__________________
  Reply With Quote
10-26-09, 07:31 AM   #2
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Your current code would be helpful, so we can track down your problem
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
10-26-09, 07:52 AM   #3
Malecden
A Murloc Raider
 
Malecden's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 6
Silly me, that would help eh?

Here's the .toc
Code:
## Interface: 30200
## Title: MasterPoisoner
## Author: Malecden
## Version: 1.02
## Notes: An addon designed to automate weapon swapping for Mutilate Rogues
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariables: ipWeapon,dpWeapon,dpTimer,spec
MasterPoisonerForm.xml
MasterPoisoner.lua
Localization.lua


And Here's the .lua. The function ChangeSpec is the area in which the spec variable is modified, and of course the addon_loaded area is where the default value would be set.
Code:
SlashCmdList["MASTERPOISONER"]=function()
    MasterPoisonerSlash()
    end
function MasterPoisonerSlash(msg,editbox)
    MasterPoisonerForm:Show()
end
SLASH_MASTERPOISONER1="/mp"
function MasterPoisonerEvent(arg1)
local timer=dpTimer
local deadlyPoison=dp
    if(event=="ADDON_LOADED") then
        if(ipWeapon==nil) then
            ipWeapon=""
        end
        if(dpWeapon==nil) then
            dpWeapon=""
        end
        if(dpTimer==nil) then
            dpTimer=4
        end
        if(spec==nil) then
            spec=1
        end
        MasterPoisonerFormIpWeapon:SetText(ipWeapon)
        MasterPoisonerFormDpWeapon:SetText(dpWeapon)
        MasterPoisonerFormDpTimer:SetValue(dpTimer)
        local label=getglobal("MasterPoisonerForm".."DpTimerLabel".."Label")
        label:SetText(MasterPoisonerFormDpTimer:GetValue())
        MasterPoisonerFormDpTimerLabel:SetText(dpTimer)
        if(spec==1) then
            MasterPoisonerFormSpec1:SetChecked(true)
            MasterPoisonerFormSpec2:SetChecked(false)
        else
            MasterPoisonerFormSpec1:SetChecked(false)
            MasterPoisonerFormSpec2:SetChecked(true)
        end
    end
    if(event=="UNIT_COMBAT"  or event=="UNIT_TARGET") then
    local poisoned=false
    local ipEquipped
        if(GetActiveTalentGroup()==spec) then
            for i=1,40 do 
                local n,_,_,s,_,_,x,c,_=UnitDebuff("target",i)
                if n==deadlyPoison and c=="player" then                
                  if x-GetTime()<timer then  
                    if ipEquipped then
                      EquipItemByName(MasterPoisonerFormDpWeapon:GetText(), 17)
                      poisoned=true
                      ipEquipped=false
                    end
                  end
                end
                if n==deadlyPoison and c=="player" and s==5 then                
                  if x-GetTime()>timer then     
                    if not ipEquipped then
                      EquipItemByName(MasterPoisonerFormIpWeapon:GetText(), 17)
                      poisoned=true
                      ipEquipped=true
                    end
                  end
                end
            end
            if(poisoned==false) then
                EquipItemByName(MasterPoisonerFormDpWeapon:GetText(), 17)
                ipEquipped=false
            end
        end
    end
end   
function ChangeSpec(specNum)
    spec=specNum
     if(spec==1) then
        MasterPoisonerFormSpec1:SetChecked(true)
        MasterPoisonerFormSpec2:SetChecked(false)
     else
        MasterPoisonerFormSpec1:SetChecked(false)
        MasterPoisonerFormSpec2:SetChecked(true)
     end
end
function SetVars()
    ipWeapon=MasterPoisonerFormIpWeapon:GetText()
    dpWeapon=MasterPoisonerFormDpWeapon:GetText()
    dpTimer=MasterPoisonerFormDpTimer:GetValue()
end
function ChangeDpTimer()
    dpTimer=MasterPoisonerFormDpTimer:GetValue()
    local label=getglobal("MasterPoisonerForm".."DpTimerLabel".."Label")
    label:SetText(MasterPoisonerFormDpTimer:GetValue())
end
Thanks again for any help
__________________
  Reply With Quote
10-26-09, 08:58 AM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
I'm assuming that either this isn't your whole code or you have an XML file? Where are you calling the ChangeSpec function from? And what arg are you passing to it? Because if specNum is nil then your spec variable is going to be nil (because of your spec=specNum line).

Also, the vars in saved vars are global. That means that you want to use as few global variables as possible and to make them as specific as possible for your addon. In other words, "spec" is *very* generic, and may be overwritten by any other addon that accidentally/poorly uses "spec" as a global variable. I suggest using a table named after your addon (ex. MasterPoisonerDB) as your saved variable and store whatever you need to keep in there (ex. MasterPoisonerDB.spec).
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
10-26-09, 09:07 AM   #5
Malecden
A Murloc Raider
 
Malecden's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 6
Yes, there is an xml file, the ChangeSpec function is called when one of the two check boxes is clicked (corresponding to each spec), this sends either a 1 or a 2 depending on the spec desired. Ill try using a table and see if the issue is resolved. Thanks again.

Here is the XML just in case, but hopefully your suggestion fixes the issue.
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!--Autogenerated by wowuides, Version=1.0.300.0, Culture=neutral, PublicKeyToken=null-->
  <Frame name="MasterPoisonerForm" hidden="true" movable="true">
    <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508883-59c2-4f83-ae10-27aaad48391b" />-->
    <Size>
      <AbsDimension x="349" y="145" />
    </Size>
    <Anchors>
      <Anchor point="CENTER" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="0" y="0" />
        </Offset>
      </Anchor>
    </Anchors>
    <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
      <BackgroundInsets>
        <AbsInset left="11" right="12" top="12" bottom="11" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="32" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="32" />
      </EdgeSize>
    </Backdrop>
    <Layers>
      <Layer>
        <Texture name="$parentTitleBorder" file="Interface\DialogFrame\UI-DialogBox-Header">
          <Size>
            <AbsDimension x="160" y="32" />
          </Size>
          <Anchors>
            <Anchor point="TOP">
              <Offset>
                <AbsDimension x="0" y="5" />
              </Offset>
            </Anchor>
          </Anchors>
          <TexCoords left="0.2" right="0.8" top="0" bottom="0.6" />
        </Texture>
        <FontString name="$parentTitleString" font="Fonts\FRIZQT__.TTF" text="Master Poisoner">
          <Size>
            <AbsDimension x="140" y="0" />
          </Size>
          <Anchors>
            <Anchor point="TOP">
              <Offset>
                <AbsDimension x="0" y="-4" />
              </Offset>
            </Anchor>
          </Anchors>
          <FontHeight>
            <AbsValue val="12" />
          </FontHeight>
          <Color r="1" g="0.8196079" b="0" />
          <Shadow>
            <Color r="0" g="0" b="0" />
            <Offset>
              <AbsDimension x="1" y="-1" />
            </Offset>
          </Shadow>
        </FontString>
      </Layer>
    </Layers>
    <Frames>
      <Frame name="$parentLabel6">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508885-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="75" y="14" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="225" y="-118" />
            </Offset>
          </Anchor>
        </Anchors>
        <Layers>
          <Layer>
            <FontString name="$parentLabel" font="Fonts\FRIZQT__.TTF" text="seconds">
              <Anchors>
                <Anchor point="TOPLEFT" />
                <Anchor point="BOTTOMRIGHT" />
              </Anchors>
              <FontHeight>
                <AbsValue val="12" />
              </FontHeight>
              <Color r="1" g="0.8196079" b="0" />
              <Shadow>
                <Color r="0" g="0" b="0" />
                <Offset>
                  <AbsDimension x="1" y="-1" />
                </Offset>
              </Shadow>
            </FontString>
          </Layer>
        </Layers>
      </Frame>
      <Slider name="$parentDpTimer" minValue="1" maxValue="6" defaultValue="4" valueStep="1" orientation="HORIZONTAL">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4976-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="172" y="17" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="155" y="-101" />
            </Offset>
          </Anchor>
        </Anchors>
        <Backdrop bgFile="Interface\Buttons\UI-SliderBar-Background" edgeFile="Interface\Buttons\UI-SliderBar-Border" tile="true">
          <BackgroundInsets>
            <AbsInset left="3" right="3" top="6" bottom="6" />
          </BackgroundInsets>
          <TileSize>
            <AbsValue val="8" />
          </TileSize>
          <EdgeSize>
            <AbsValue val="8" />
          </EdgeSize>
        </Backdrop>
        <HitRectInsets>
          <AbsInset left="0" right="0" top="-10" bottom="-10" />
        </HitRectInsets>
        <Scripts>
          <OnClick>ChangeDpTimer()
</OnClick>
          <OnValueChanged>ChangeDpTimer()
</OnValueChanged>
          <OnHorizontalScroll>ChangeDpTimer()
</OnHorizontalScroll>
        </Scripts>
        <ThumbTexture name="$parentThumb" file="Interface\Buttons\UI-SliderBar-Button-Horizontal">
          <Size>
            <AbsDimension x="32" y="32" />
          </Size>
        </ThumbTexture>
      </Slider>
      <Frame name="$parentDpTimerLabel">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508885-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="75" y="14" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="181" y="-118" />
            </Offset>
          </Anchor>
        </Anchors>
        <Layers>
          <Layer>
            <FontString name="$parentLabel" font="Fonts\FRIZQT__.TTF" text="4">
              <Anchors>
                <Anchor point="TOPLEFT" />
                <Anchor point="BOTTOMRIGHT" />
              </Anchors>
              <FontHeight>
                <AbsValue val="12" />
              </FontHeight>
              <Color r="1" g="0.8196079" b="0" />
              <Shadow>
                <Color r="0" g="0" b="0" />
                <Offset>
                  <AbsDimension x="1" y="-1" />
                </Offset>
              </Shadow>
            </FontString>
          </Layer>
        </Layers>
      </Frame>
      <Button name="$parentButton1" text="Ok">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4973-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="50" y="18" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="21" y="-13" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
          <OnClick>MasterPoisonerForm:Hide();
SetVars()
</OnClick>
        </Scripts>
        <NormalTexture file="Interface\Buttons\UI-Panel-Button-Up">
          <TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
        </NormalTexture>
        <PushedTexture file="Interface\Buttons\UI-Panel-Button-Down">
          <TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
        </PushedTexture>
        <DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled">
          <TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
        </DisabledTexture>
        <HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD">
          <TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
        </HighlightTexture>
        <ButtonText name="$parentText">
          <FontHeight>
            <AbsValue val="10" />
          </FontHeight>
        </ButtonText>
        <NormalFont style="GameFontNormal" />
        <HighlightFont style="GameFontHighlight" />
        <DisabledFont style="GameFontDisable" />
        <PushedTextOffset x="0" y="0" />
      </Button>
      <Frame name="$parentLabel1">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508885-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="75" y="18" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="21" y="-32" />
            </Offset>
          </Anchor>
        </Anchors>
        <Layers>
          <Layer>
            <FontString name="$parentLabel" font="Fonts\FRIZQT__.TTF" text="IP Weapon">
              <Anchors>
                <Anchor point="TOPLEFT" />
                <Anchor point="BOTTOMRIGHT" />
              </Anchors>
              <FontHeight>
                <AbsValue val="12" />
              </FontHeight>
              <Color r="1" g="0.8196079" b="0" />
              <Shadow>
                <Color r="0" g="0" b="0" />
                <Offset>
                  <AbsDimension x="1" y="-1" />
                </Offset>
              </Shadow>
            </FontString>
          </Layer>
        </Layers>
      </Frame>
      <Frame name="$parentLabel5">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4978-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="10" y="32" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="317" y="-30" />
            </Offset>
          </Anchor>
        </Anchors>
        <Layers>
          <Layer>
            <FontString name="$parentLabel" setAllPoints="true" font="Fonts\FRIZQT__.TTF" text="1" justifyH="LEFT">
              <FontHeight>
                <AbsValue val="12" />
              </FontHeight>
              <Color r="1" g="0.8196079" b="0" />
              <Shadow>
                <Color r="0" g="0" b="0" />
                <Offset>
                  <AbsDimension x="1" y="-1" />
                </Offset>
              </Shadow>
            </FontString>
          </Layer>
        </Layers>
      </Frame>
      <Frame name="$parentComponent1">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4978-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="10" y="32" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="317" y="-63" />
            </Offset>
          </Anchor>
        </Anchors>
        <Layers>
          <Layer>
            <FontString name="$parentLabel" setAllPoints="true" font="Fonts\FRIZQT__.TTF" text="2" justifyH="LEFT">
              <FontHeight>
                <AbsValue val="12" />
              </FontHeight>
              <Color r="1" g="0.8196079" b="0" />
              <Shadow>
                <Color r="0" g="0" b="0" />
                <Offset>
                  <AbsDimension x="1" y="-1" />
                </Offset>
              </Shadow>
            </FontString>
          </Layer>
        </Layers>
      </Frame>
      <Frame name="$parentLabel4">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4978-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="34" y="22" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="289" y="-13" />
            </Offset>
          </Anchor>
        </Anchors>
        <Layers>
          <Layer>
            <FontString name="$parentLabel" setAllPoints="true" font="Fonts\FRIZQT__.TTF" text="Spec">
              <FontHeight>
                <AbsValue val="12" />
              </FontHeight>
              <Color r="1" g="0.8196079" b="0" />
              <Shadow>
                <Color r="0" g="0" b="0" />
                <Offset>
                  <AbsDimension x="1" y="-1" />
                </Offset>
              </Shadow>
            </FontString>
          </Layer>
        </Layers>
      </Frame>
      <CheckButton name="$parentSpec2">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4974-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="32" y="32" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="289" y="-63" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
          <OnClick>ChangeSpec(2)
</OnClick>
        </Scripts>
        <NormalTexture file="Interface\Buttons\UI-CheckBox-Up" />
        <PushedTexture file="Interface\Buttons\UI-CheckBox-Down" />
        <DisabledTexture />
        <HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" />
        <PushedTextOffset x="0" y="0" />
        <CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" />
        <DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" />
      </CheckButton>
      <CheckButton name="$parentSpec1" checked="true">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4974-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="32" y="32" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="289" y="-30" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
          <OnClick>ChangeSpec(1)
</OnClick>
        </Scripts>
        <NormalTexture file="Interface\Buttons\UI-CheckBox-Up" />
        <PushedTexture file="Interface\Buttons\UI-CheckBox-Down" />
        <DisabledTexture />
        <HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD" />
        <PushedTextOffset x="0" y="0" />
        <CheckedTexture file="Interface\Buttons\UI-CheckBox-Check" />
        <DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled" />
      </CheckButton>
      <EditBox name="$parentDpWeapon" autoFocus="false">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4975-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="181" y="30" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="102" y="-65" />
            </Offset>
          </Anchor>
        </Anchors>
        <Backdrop bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
          <BackgroundInsets>
            <AbsInset left="3" right="5" top="3" bottom="5" />
          </BackgroundInsets>
          <TileSize>
            <AbsValue val="16" />
          </TileSize>
          <EdgeSize>
            <AbsValue val="16" />
          </EdgeSize>
        </Backdrop>
        <Scripts>
          <OnEnterPressed>this:ClearFocus()</OnEnterPressed>
          <OnEscapePressed>this:ClearFocus()</OnEscapePressed>
        </Scripts>
        <FontString font="Fonts\ARIALN.TTF">
          <FontHeight>
            <AbsValue val="14" />
          </FontHeight>
          <Color r="1" g="1" b="1" />
          <Shadow>
            <Color r="0" g="0" b="0" />
            <Offset>
              <AbsDimension x="1" y="-1" />
            </Offset>
          </Shadow>
        </FontString>
        <HighlightColor r="1" g="1" b="1" />
        <TextInsets>
          <AbsInset left="5" right="0" top="0" bottom="0" />
        </TextInsets>
      </EditBox>
      <EditBox name="$parentIpWeapon" autoFocus="false">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4975-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="181" y="30" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="102" y="-32" />
            </Offset>
          </Anchor>
        </Anchors>
        <Backdrop bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
          <BackgroundInsets>
            <AbsInset left="3" right="5" top="3" bottom="5" />
          </BackgroundInsets>
          <TileSize>
            <AbsValue val="16" />
          </TileSize>
          <EdgeSize>
            <AbsValue val="16" />
          </EdgeSize>
        </Backdrop>
        <Scripts>
          <OnEnterPressed>this:ClearFocus()</OnEnterPressed>
          <OnEscapePressed>this:ClearFocus()</OnEscapePressed>
        </Scripts>
        <FontString font="Fonts\ARIALN.TTF">
          <FontHeight>
            <AbsValue val="14" />
          </FontHeight>
          <Color r="1" g="1" b="1" />
          <Shadow>
            <Color r="0" g="0" b="0" />
            <Offset>
              <AbsDimension x="1" y="-1" />
            </Offset>
          </Shadow>
        </FontString>
        <HighlightColor r="1" g="1" b="1" />
        <TextInsets>
          <AbsInset left="5" right="0" top="0" bottom="0" />
        </TextInsets>
      </EditBox>
      <Frame name="$parentLabel3">
        <!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4978-d66d-444e-bb2d-1ad102c87fed" />-->
        <Size>
          <AbsDimension x="128" y="17" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="21" y="-101" />
            </Offset>
          </Anchor>
        </Anchors>
        <Layers>
          <Layer>
            <FontString name="$parentLabel" setAllPoints="true" font="Fonts\FRIZQT__.TTF" text="Time Before DP Drops">
              <FontHeight>
                <AbsValue val="12" />
              </FontHeight>
              <Color r="1" g="0.8196079" b="0" />
              <Shadow>
                <Color r="0" g="0" b="0" />
                <Offset>
                  <AbsDimension x="1" y="-1" />
                </Offset>
              </Shadow>
            </FontString>
          </Layer>
        </Layers>
      </Frame>
      <Frame name="$parentLabel2">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508885-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="75" y="18" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="21" y="-65" />
            </Offset>
          </Anchor>
        </Anchors>
        <Layers>
          <Layer>
            <FontString name="$parentLabel" font="Fonts\FRIZQT__.TTF" text="DP Weapon">
              <Anchors>
                <Anchor point="TOPLEFT" />
                <Anchor point="BOTTOMRIGHT" />
              </Anchors>
              <FontHeight>
                <AbsValue val="12" />
              </FontHeight>
              <Color r="1" g="0.8196079" b="0" />
              <Shadow>
                <Color r="0" g="0" b="0" />
                <Offset>
                  <AbsDimension x="1" y="-1" />
                </Offset>
              </Shadow>
            </FontString>
          </Layer>
        </Layers>
      </Frame>
    </Frames>
    <Scripts>
      <OnLoad>this:RegisterEvent("UNIT_COMBAT");
this:RegisterEvent("ADDON_LOADED");
this:RegisterEvent("UNIT_TARGET");
tinsert(UISpecialFrames,this:GetName());
this:RegisterForDrag("LeftButton")
</OnLoad>
      <OnEvent>MasterPoisonerEvent()
</OnEvent>
      <OnShow>PlaySound("igCharacterInfoOpen");</OnShow>
      <OnHide>PlaySound("igCharacterInfoClose");</OnHide>
      <OnDragStart>this:StartMoving();
this.isMoving = true;
</OnDragStart>
      <OnDragStop>this:StopMovingOrSizing();
this.isMoving = false;
</OnDragStop>
    </Scripts>
  </Frame>
</Ui>
__________________

Last edited by Malecden : 10-26-09 at 09:11 AM.
  Reply With Quote
11-02-09, 03:37 PM   #6
Drshow
A Cyclonian
 
Drshow's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 49
Originally Posted by Malecden View Post
Silly me, that would help eh?

Here's the .toc
Code:
## Interface: 30200
## Title: MasterPoisoner
## Author: Malecden
## Version: 1.02
## Notes: An addon designed to automate weapon swapping for Mutilate Rogues
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariables: ipWeapon,dpWeapon,dpTimer,spec
MasterPoisonerForm.xml
MasterPoisoner.lua
Localization.lua
Maybe im off here a little but you should be calling setting per character.
Code:
## Interface: 30200
## Title: MasterPoisoner
## Author: Malecden
## Version: 1.02
## Notes: An addon designed to automate weapon swapping for Mutilate Rogues
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariablesPerCharacter: ipWeapon,dpWeapon,dpTimer,spec
MasterPoisonerForm.xml
MasterPoisoner.lua
Localization.lua
This will create tables each for, with each having its own settings.

\WTF\Account\YourAccountName\RelmName\UserName\SavedVariables\YourAddon.lua &
\WTF\Account\YourAccountName\RelmName\UserName\SavedVariables\YourAddon.lua.bak
__________________

Last edited by Drshow : 11-02-09 at 03:42 PM.
  Reply With Quote
11-02-09, 03:41 PM   #7
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Something I've seen a lot of people do, and seems to be a good practice, is to use a single saved variable, make it a table, and name it based on the addon.

So you could use something like MasterPoisonerDB and have ipWeapon, dpWeapon, dpTimer, and spec be entries in that table.
  Reply With Quote
11-02-09, 03:55 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
/me coughs and point to post #4



/innocent!
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-03-09, 06:28 AM   #9
Drshow
A Cyclonian
 
Drshow's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 49
Originally Posted by Seerah View Post
/me coughs and point to post #4



/innocent!
LMFAO @ innocent, mmhmmm all i have to say is sometimes people need to see the fire before it burns them or they dont know its fire.
__________________
  Reply With Quote
11-03-09, 06:55 AM   #10
Malecden
A Murloc Raider
 
Malecden's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 6
Just wanted to update, I got it all fixed, thanks so much for the suggestions, its working 100% as intended now .
__________________
  Reply With Quote
11-03-09, 01:42 PM   #11
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Originally Posted by Seerah View Post
/me coughs and point to post #4



/innocent!
Really helps if I read some of the other posts completely before jumping in.
  Reply With Quote
11-05-09, 06:36 AM   #12
Drshow
A Cyclonian
 
Drshow's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 49
Originally Posted by wurmfood View Post
Really helps if I read some of the other posts completely before jumping in.
OMG what a tease, Post the fixed code snippet for us so we have an archive of the snippet, perhaps the next who runs into same problems will have a faster solution.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Saved Variable Issue


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