I think I get what you mean. I'm really new to how this stuff works(Im not a total code noob as I'm good with PHP) but I'll see what I can do today.
---------- Post added 2010-10-23 at 01:24 AM ----------
Ok, I think I'm almost there.
Its saving the saved variables correctly.
TOC File
Code:
## Interface: 40000
## Title: Sidebars Status
## SavedVariables:
## SavedVariablesPerCharacter: leftbar1, leftbar2, rightbar1, rightbar2
Saved Variables File(atm)
Code:
leftbar1 = false
leftbar2 = false
rightbar1 = nil
rightbar2 = nil
kgpanels code
OnLoad
Code:
self:RegisterEvent("ADDON LOADED");
self:RegisterEvent("PLAYER_LOGOUT");
OnEvent
Code:
local left_bars_1_container = kgPanels:FetchFrame("LEFT_BARS_1_CONTAINER")
local left_bars_1_connector_top = kgPanels:FetchFrame("LEFT_BARS_1_CONNECTOR_TOP")
local left_bars_1_connector_mid = kgPanels:FetchFrame("LEFT_BARS_1_CONNECTOR_MID")
local left_bars_1_connector_bottom = kgPanels:FetchFrame("LEFT_BARS_1_CONNECTOR_BOTTOM")
local left_bars_2_container = kgPanels:FetchFrame("LEFT_BARS_2_CONTAINER")
local left_bars_2_connector_top = kgPanels:FetchFrame("LEFT_BARS_2_CONNECTOR_TOP")
local left_bars_2_connector_mid = kgPanels:FetchFrame("LEFT_BARS_2_CONNECTOR_MID")
local left_bars_2_connector_bottom = kgPanels:FetchFrame("LEFT_BARS_2_CONNECTOR_BOTTOM")
if event == "ADDON_LOADED" and arg[1] == "sidebarstatus" then
if leftbar1 == true then
left_bars_1_container:Show();
left_bars_1_connector_top:Show();
left_bars_1_connector_mid:Show();
left_bars_1_connector_bottom:Show();
MultiBarBottomLeftButton1:Show();
MultiBarBottomLeftButton2:Show();
MultiBarBottomLeftButton3:Show();
MultiBarBottomLeftButton4:Show();
MultiBarBottomLeftButton5:Show();
MultiBarBottomLeftButton6:Show();
MultiBarBottomLeftButton7:Show();
MultiBarBottomLeftButton8:Show();
MultiBarBottomLeftButton9:Show();
MultiBarBottomLeftButton10:Show();
MultiBarBottomLeftButton11:Show();
MultiBarBottomLeftButton12:Show();
if leftbar2 == true then
left_bars_2_container:Show();
left_bars_2_connector_top:Show();
left_bars_2_connector_mid:Show();
left_bars_2_connector_bottom:Show();
DominosActionButton1:Show();
DominosActionButton2:Show();
DominosActionButton3:Show();
DominosActionButton4:Show();
DominosActionButton5:Show();
DominosActionButton6:Show();
DominosActionButton7:Show();
DominosActionButton8:Show();
DominosActionButton9:Show();
DominosActionButton10:Show();
DominosActionButton11:Show();
DominosActionButton12:Show();
else
left_bars_2_container:Hide();
left_bars_2_connector_top:Hide();
left_bars_2_connector_mid:Hide();
left_bars_2_connector_bottom:Hide();
DominosActionButton1:Hide();
DominosActionButton2:Hide();
DominosActionButton3:Hide();
DominosActionButton4:Hide();
DominosActionButton5:Hide();
DominosActionButton6:Hide();
DominosActionButton7:Hide();
DominosActionButton8:Hide();
DominosActionButton9:Hide();
DominosActionButton10:Hide();
DominosActionButton11:Hide();
DominosActionButton12:Hide();
end
else
left_bars_1_container:Hide();
left_bars_1_connector_top:Hide();
left_bars_1_connector_mid:Hide();
left_bars_1_connector_bottom:Hide();
MultiBarBottomLeftButton1:Hide();
MultiBarBottomLeftButton2:Hide();
MultiBarBottomLeftButton3:Hide();
MultiBarBottomLeftButton4:Hide();
MultiBarBottomLeftButton5:Hide();
MultiBarBottomLeftButton6:Hide();
MultiBarBottomLeftButton7:Hide();
MultiBarBottomLeftButton8:Hide();
MultiBarBottomLeftButton9:Hide();
MultiBarBottomLeftButton10:Hide();
MultiBarBottomLeftButton11:Hide();
MultiBarBottomLeftButton12:Hide();
end
end
if event == "PLAYER_LOGOUT" then
if left_bars_1_container:IsVisible() then
leftbar1 = true;
if left_bars_2_container:IsVisible() then
leftbar2 = true;
end
else
leftbar1 = false;
leftbar2 = false;
end
end
I think the kgpanels part is where its falling over to be honest, Its as if it cant run it correctly, maybe I need a different event for the player login, maybe even PLAYER_ENTERING_WORLD?
---------- Post added 2010-10-23 at 01:38 AM ----------
Switching to PLAYER_ENTERING_WORLD works, I do realise there are limitations to this (it will reset when entering instances etc) but that I can live with.
Thanks Treeston & ComputerNerd!
LAST EDIT - It was possible to make the bars stay appeared even through multiple "PLAYER_ENTERING_WORLD" Instances just by changing the leftbar1/leftbar2/rightbar1/rightbar2 every time they are shown or hidden.