WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Please say why this addon code does not hide the exp bar (https://www.wowinterface.com/forums/showthread.php?t=12343)

Rabscuttle of Executus 09-21-07 10:50 AM

Please say why this addon code does not hide the exp bar
 
NOTE: Everything else hides fine. I also tried having a "MainMenuExpBar" string in my frames_hide_list array or table or whatever but that didn't work either. I know the frame name is correct because I can do "/script MainMenuExpBar:Hide()" in game and it works. Why oh why does this not work?

frames_hide_list={"MinimapToggleButton",
"GameTimeFrame", "MinimapZoomOut", "MinimapZoomIn", "MiniMapWorldMapButton"};

function HideFrames_OnLoad()
MainMenuExpBar:Hide();
var=5;
repeat
getglobal(frames_hide_list[var]):Hide();
var = var-1;
until var==0
end

HideFrames_OnLoad();

Polarina 09-21-07 11:32 AM

Quote:

Originally Posted by Rabscuttle of Executus
NOTE: Everything else hides fine. I also tried having a "MainMenuExpBar" string in my frames_hide_list array or table or whatever but that didn't work either. I know the frame name is correct because I can do "/script MainMenuExpBar:Hide()" in game and it works. Why oh why does this not work?

frames_hide_list={"MinimapToggleButton",
"GameTimeFrame", "MinimapZoomOut", "MinimapZoomIn", "MiniMapWorldMapButton"};

function HideFrames_OnLoad()
MainMenuExpBar:Hide();
var=5;
repeat
getglobal(frames_hide_list[var]):Hide();
var = var-1;
until var==0
end

HideFrames_OnLoad();

What error message do you get?

Nynaeve 09-21-07 12:10 PM

I wish I could help you with this, but seeing as how I currently can't get the default Blizzard player frame and target frame to hide.... and they pop back up every time I zone or die (which happens a lot on my alt, since she is, in fact, a holy priest :S ) I don't think I could help you much. :(

Rabscuttle of Executus 09-21-07 12:24 PM

Quote:

Originally Posted by Polarina
What error message do you get?

That's the thing, there are no error messages. Which is a big reason why I decided to post the code here - I really don't get how it just doesn't work.

Polarina 09-21-07 12:33 PM

Quote:

Originally Posted by Rabscuttle of Executus
That's the thing, there are no error messages. Which is a big reason why I decided to post the code here - I really don't get how it just doesn't work.

Main Menu (ESC) -> Interface Options -> Basic -> Display Lua Errors.

Rabscuttle of Executus 09-21-07 12:59 PM

Quote:

Originally Posted by Polarina
Main Menu (ESC) -> Interface Options -> Basic -> Display Lua Errors.

Maybe I should have been more clear.

When errors do happen, I see them. There are no errors being displayed because my addon does not cause any. That's what I meant with my above post.

Seerah 09-21-07 12:59 PM

It could not work at not give off errors, Polarina. ;)

Anyway, I'm no real coder, but it looks off to me...

Polarina 09-21-07 01:08 PM

Quote:

Originally Posted by Rabscuttle of Executus
NOTE: Everything else hides fine. I also tried having a "MainMenuExpBar" string in my frames_hide_list array or table or whatever but that didn't work either. I know the frame name is correct because I can do "/script MainMenuExpBar:Hide()" in game and it works. Why oh why does this not work?

frames_hide_list={"MinimapToggleButton",
"GameTimeFrame", "MinimapZoomOut", "MinimapZoomIn", "MiniMapWorldMapButton"};

function HideFrames_OnLoad()
MainMenuExpBar:Hide();
var=5;
repeat
getglobal(frames_hide_list[var]):Hide();
var = var-1;
until var==0
end

HideFrames_OnLoad();

The string "MainMenuExpBar" is not in the table 'frames_hide_list'.

Rabscuttle of Executus 09-21-07 01:47 PM

Quote:

Originally Posted by Rabscuttle of Executus
NOTE: Everything else hides fine. I also tried having a "MainMenuExpBar" string in my frames_hide_list array or table or whatever but that didn't work either. I know the frame name is correct because I can do "/script MainMenuExpBar:Hide()" in game and it works. Why oh why does this not work?

Any more clarifications? That wasn't snappy, I'm serious, I'll explain as much as possible if it helps you help me.

Polarina 09-21-07 01:50 PM

Quote:

Originally Posted by Rabscuttle of Executus
Any more clarifications? That wasn't snappy, I'm serious, I'll explain as much as possible if it helps you help me.

Change:

var=5;

to:

var = #frame_hide_list;

Rabscuttle of Executus 09-21-07 02:01 PM

Quote:

Originally Posted by Polarina
Change:

var=5;

to:

var = #frame_hide_list;

Well, I tried that and it didn't work. Thank you for the try though.

Rabscuttle of Executus 09-23-07 05:01 PM

bump. still don't get why it works in game but not as a part of this addon code.

Kaomie 09-23-07 05:51 PM

What is the level of the character you are trying to do that with?

Have you tried to force a MainMenuExpBar_Update(); (not sure if is protected or if it does anything)?

Are you catching any Event that may cause the bar to auto-reappear (like PLAYER_XP_UPDATE, PLAYER_ENTERING_WORLD, who knows ;) )

Dridzt 09-23-07 06:05 PM

Could it be that OnLoad is too soon to call that code?

Put some debug prints in that loop and check that it actually runs
and the frames exist at the time it tries to run?

Simplest form would be DEFAULT_CHAT_FRAME:AddMessage("message");

Kaomie 09-23-07 06:13 PM

Must be, because the code is valid and executes fine:


Rabscuttle of Executus 09-23-07 06:33 PM

Quote:

Originally Posted by Kaomie
Must be, because the code is valid and executes fine:


Cool, what's that LuaSlinger thing, does that just run lua scripts ingame? Like WoWLua?

Anyway, thanks for looking into it.

Rabscuttle of Executus 09-23-07 06:35 PM

Quote:

Originally Posted by Dridzt
Could it be that OnLoad is too soon to call that code?

What do I do to call it later? Excuse me if its obvious but this obviously has yet to become a strong point for me :D

Kaomie 09-23-07 07:36 PM

Quote:

Originally Posted by Rabscuttle of Executus
What do I do to call it later? Excuse me if its obvious but this obviously has yet to become a strong point for me :D

Okay so the XP bar definitely comes up very late in the loading process. Neither PLAYER_LOGIN or PLAYER_ENTERING_WORLD are late enough, but PLAYER_ALIVE is it seems.

Try this:
Code:

frames_hide_list={"MainMenuExpBar", "MinimapToggleButton", "GameTimeFrame", "MinimapZoomOut", "MinimapZoomIn", "MiniMapWorldMapButton"};

function HideXP_OnLoad ()
  ChatFrame1:AddMessage ("test OK");
  var = #frames_hide_list;
  repeat
        getglobal (frames_hide_list[var]):Hide ();
        var = var - 1;
  until var == 0
end


function HideXP_OnEvent ()
  if (event == "PLAYER_ALIVE") then
    HideXP_OnLoad ();
  end
end

local HideXP = CreateFrame ("frame");
HideXP:SetScript ("OnEvent", HideXP_OnEvent);
HideXP:RegisterEvent ("PLAYER_ALIVE");


Rabscuttle of Executus 09-24-07 06:21 AM

Thanks a lot, there seems to be some new stuff there for me to look up and learn about.


All times are GMT -6. The time now is 11:31 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI