Thread Tools Display Modes
06-23-06, 01:47 PM   #1
danterner
A Murloc Raider
Join Date: Jun 2006
Posts: 4
Advice with coding for Battlefield Minimap Addon, please?

For a while now I have been using the following script, which I have assigned to a macro:

/script BattlefieldMinimap_LoadUI() if(BattlefieldMinimap:IsVisible()) then BattlefieldMinimap:Hide(); else BattlefieldMinimap:Show(); end
This opens the battleground minimap, which I prefer to keep open as a part of my interface (in addition to the regular minimap). Here's a screenshot of an outdated version of my interface, showing it in action: http://treelo.50megs.com/CuteMAP1.htm

I would like to turn this script into an addon, so that it can be launched automatically on startup. I have no experience with XML or LUA, but I have been trying to teach myself. So far, no success. I've come up with the following, which isn't working. Can anyone show me where I'm going wrong?

The .toc:
## Interface: 11100
## Title: treelobattlemap
## Notes: Displays the Battlefield Minimap anytime, anywhere.
treelobattlemap.xml
The .xml:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">


<!-- Load Script file -->
<Script file="treelobattlemap.lua"/>
<Frame name="treelobattlemap">
<Scripts>
<OnLoad>
treelobattlemap_OnLoad();
</OnLoad>
</Scripts>
</Frame>

</Ui>
The .lua:
function treelobattlemap_OnLoad()
BattlefieldMinimap_LoadUI() if(BattlefieldMinimap:IsVisible()) then BattlefieldMinimap:Hide(); else BattlefieldMinimap:Show(); end
Any help would be very much appreciated.
  Reply With Quote
06-23-06, 02:17 PM   #2
Nyrine
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 23
Code:
function treelobattlemap_OnLoad()
BattlefieldMinimap_LoadUI() if(BattlefieldMinimap:IsVisible()) then BattlefieldMinimap:Hide(); else BattlefieldMinimap:Show(); end


Why not just

Code:
function treelobattlemap_OnLoad()
  BattlefieldMinimap_LoadUI()
  if(!BattlefieldMinimap:IsVisible()) then
    BattlefieldMinimap:Show();
  end
end
Your code seems to be missing an end (you need one for the if, and one for the function)
  Reply With Quote
06-23-06, 10:58 PM   #3
danterner
A Murloc Raider
Join Date: Jun 2006
Posts: 4
Originally Posted by Nyrine
Your code seems to be missing an end (you need one for the if, and one for the function)
Thank you so much for responding. I tried what you suggested but still couldn't get it working. It doesn't throw an error message, but neither does it work for me. I must be doing something else wrong, as well. I have been able to use the AlphaMap addon to achieve basically the same result as what I was intending to do here, though, so all is well. Thanks again for the assistance!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Advice with coding for Battlefield Minimap Addon, please?


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