• 0

    posted a message on Newbe Request for assistance
    Okay I have managed to get my addon to be displayed when the world map is shown, I have also been able to set the position of the button when the map is show.

    The problem I am having ATM is when I use the map button the re sizes the map so that its smaller, the button moves to a silly location on the smaller map.

    so it is possible to set two different locations one for the large map and one for the smaller map.

    My Code currently

    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/
    
        http://wowprogramming.com/FrameXML/UI.xsd">
    
    
        <Button name="PointMe_Button"
     inherits="GameMenuButtonTemplate"
     parent="WorldMapFrame" text="Point Me">
    
            <Anchors>
                <Anchor point="TOPRIGHT">
                    <Offset x="-50" y="-40"/>
                </Anchor>
            </Anchors>
    
            <Scripts>
    
                <OnClick>
    
                    PointMe_ButtonOnClick(self, button, down)
    
                </OnClick>
    
            </Scripts>
    
        </Button>
    
        <Frame name="PointMe_DropDown" inherits="UIDropDownMenuTemplate" frameStrata="FULLSCREEN_DIALOG">
    
            <Scripts>
    
                <OnLoad>
    
                    PointMe_DropDownOnLoad(self)
    
                </OnLoad>
    
            </Scripts>
    
        </Frame>
    
    </Ui>


    LUA
    function PointMe_InitializeDropDown(self, level)
    
    
    -- Level 1 Options [Contenent] list complete
    
        if level == 1 then
    
            local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Point Me"
    
            info.isTitle = true
    
            UIDropDownMenu_AddButton(info, level)
    
    
    
    -- Eastern Kindoms
            info = UIDropDownMenu_CreateInfo()
    
    
            info.text = "Eastern Kingdoms"
    
            info.hasArrow = true
    
            info.value = "Eastern Kindoms"
    
            UIDropDownMenu_AddButton(info, level)
    
    
    -- Kalimdor
    
    
    
    
            info = UIDropDownMenu_CreateInfo()
    
            info.text = "Kalimdor"
    
            info.hasArrow = true
    
            info.value = "Kalimdor"
    
            UIDropDownMenu_AddButton(info, level)
    
    
    -- Outland
    
            info = UIDropDownMenu_CreateInfo()
    
            info.text = "Outland"
    
            info.hasArrow = true
    
            info.value = "Outland"
    
            UIDropDownMenu_AddButton(info, level)
    
    
    -- Northrend
    
    
    
    
            info = UIDropDownMenu_CreateInfo()
    
            info.text = "Northrend"
    
            info.hasArrow = true
    
            info.value = "Northrend"
    
            UIDropDownMenu_AddButton(info, level)
    
    -- Level 2 Options [Zone] Add Options for local submenu
    
    -- Eastern Kindoms
      
        elseif (level == 2)
     and (UIDROPDOWNMENU_MENU_VALUE == "Eastern Kindoms")
     then
    
            local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Alterac Mountains"
        info.hasArrow = true
        info.value = "Alterac Mountains"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Arathi Highlands"
        info.hasArrow = true
        info.value = "Arathi Highlands"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Badlands"
        info.hasArrow = true
        info.value = "Badlands"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Blasted Lands"
        info.hasArrow = true
        info.value = "Blasted Lands"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Burning Steppes"
        info.hasArrow = true
        info.value = "Burning Steppes"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Deadwind Pass"
        info.hasArrow = true
        info.value = "Deadwind Pass"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Dun Morogh"
        info.hasArrow = true
        info.value = "Dun Morogh"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Duskwood"
        info.hasArrow = true
        info.value = "Duskwood"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Eastern Plaguelands"
        info.hasArrow = true
        info.value = "Eastern Plaguelands"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Elwynn Forest"
        info.hasArrow = true
        info.value = "Elwynn Forest"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Eversong Woods"
        info.hasArrow = true
        info.value = "Eversong Woods"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Ghostlands"
        info.hasArrow = true
        info.value = "Ghostlands"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Hillsbrad Foothills"
        info.hasArrow = true
        info.value = "Hillsbrad Foothills"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Isle of Quel'Danas"
        info.hasArrow = true
        info.value = "Isle of Quel'Danas"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Loch Modan"
        info.hasArrow = true
        info.value = "Loch Modan"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Redridge Mountains"
        info.hasArrow = true
        info.value = "Redridge Mountains"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Redridge Mountains"
        info.hasArrow = true
        info.value = "Redridge Mountains"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Silverpine Forest"
        info.hasArrow = true
        info.value = "Silverpine Forest"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Stranglethorn Vale"
        info.hasArrow = true
        info.value = "Stranglethorn Vale"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Swamp of Sorrows"
        info.hasArrow = true
        info.value = "Swamp of Sorrows"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "The Hinterlands"
        info.hasArrow = true
        info.value = "The Hinterlandss"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Tirisfal Glades"
        info.hasArrow = true
        info.value = "Tirisfal Glades"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Western Plaguelands"
        info.hasArrow = true
        info.value = "Western Plaguelands"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Westfall"
        info.hasArrow = true
        info.value = "Westfall"
    
            UIDropDownMenu_AddButton(info, level)
    
    local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Wetlands"
        info.hasArrow = true
        info.value = "Wetlands"
    
            UIDropDownMenu_AddButton(info, level)
    
    
    
    -- Kalimdor
    
    
        elseif (level == 2)
     and (UIDROPDOWNMENU_MENU_VALUE == "Kalimdor")
     then
    
            local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Beta Sub-item 1"
    
            UIDropDownMenu_AddButton(info, level)
    
    
    -- Outland
       
        elseif (level == 2)
     and (UIDROPDOWNMENU_MENU_VALUE == "Outland")
     then
    
            local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Alpha Sub-item 1"
        info.hasArrow = true
        info.value = "test"
    
            UIDropDownMenu_AddButton(info, level)
            
        local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Alpha Sub-item 2"
        info.hasArrow = true
        info.value = "test 2"
    
            UIDropDownMenu_AddButton(info, level)
    
    
    
    -- Northrend
    
    
    
    
        elseif (level == 2)
     and (UIDROPDOWNMENU_MENU_VALUE == "Northrend")
     then
    
            local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Beta Sub-item 1"
    
            UIDropDownMenu_AddButton(info, level)
    
    -- Level 3 Options [Local] Add function to options to allow for Tom Tom Commands
    
        elseif (level == 3)
     and (UIDROPDOWNMENU_MENU_VALUE == "test")
     then
    
            local info = UIDropDownMenu_CreateInfo()
    
            info.text = "Beta Sub-item 1"
    
            UIDropDownMenu_AddButton(info, level)
    
    
        
        end
    
    end
    
    
    
    
    function PointMe_DropDownOnLoad(self)
    
        UIDropDownMenu_Initialize(self, PointMe_InitializeDropDown)
    
    end
    
    
    function PointMe_ButtonOnClick(self, button, down)
    
        local name = self:GetName()
    
        ToggleDropDownMenu(1, nil, PointMe_DropDown, name, 0, 0)
    
    end
    Posted in: Lua Code Discussion
  • 0

    posted a message on Newbe Request for assistance
    Xchg you are but truly a god.

    Now with that code i can start to reverse engineer my addon.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Newbe Request for assistance
    Xinhuan, if i use your tutorial is it possible to just copy and past the relevant code into a .lua file and test it. or are there other required changes that need to be made before hand.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Newbe Request for assistance
    I have started trying to write and addon.

    What I am planing to do is create and addon that I can use, that then I open the map it will allow me to select a destination to travel to.

    I plan to do this by using multi-layer context menus that once an item is selected it will then generate a string that it can send to the Tom Tom addon.

    ATM im stuck on the first step, in trying to create multi-layer menu, I have tryed to implement the tutorial from wowwiki (http://www.wowwiki.com/Using_UIDropDownMenu) unfortunately I have had no success with this.

    Below I have listed the code from both my xml and lua files.

    I know im doing something wrong, im not sure what it is. So my request is if you can read over the code I copied from the tutorial, can you tell me what is wrong and a fix

    or if you have your own code can you post it up and give me some suggestions of how to use it.

    ** WTB xml and lua for dummies **

    XML File
    <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/">
       <Frame parent="UIParent">
           <Frames>
               <Button name="MyDropDownMenuButton">
                   <Scripts>
                       <OnClick>
                           MyDropDownMenuButton_OnClick();
                       </OnClick>
                   </Scripts>
               </Button>
           </Frames>
       </Frame>
       <Frame name="MyDropDownMenu" inherits="UIDropDownMenuTemplate" id="1">
           <Scripts>
               <OnLoad>
                   UIDropDownMenu_Initialize(this, MyDropDownMenu_OnLoad, "MENU");
               </OnLoad>
           </Scripts>
       </Frame>  <Frame parent="UIParent">
           <Frames>
               <Button name="MyDropDownMenuButton">
                   <Scripts>
                       <OnLoad>
                           UIDropDownMenu_Initialize(this, MyDropDownMenu_OnLoad);
                       </OnLoad>
                   
                       <OnClick>
                           MyDropDownMenuButton_OnClick();
                       </OnClick>
                   </Scripts>
               </Button>
           </Frames>
       </Frame>
    </Ui>


    lua file

     function MyDropDownMenu_OnLoad()
           info            = {};
           info.text       = "This is an option in the menu.";
           info.value      = "OptionVariable";
           info.func       = FunctionCalledWhenOptionIsClicked 
                     -- can also be done as function() FunctionCalledWhenOptionIsClicked() end;
           
           -- Add the above information to the options menu as a button.
           UIDropDownMenu_AddButton(info);
       end
       function MyDropDownMenuButton_OnClick() 
           ToggleDropDownMenu(1, nil, MyDropDownMenu, MyDropDownMenuButton, 0, 0);
       end
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.