Page 1 of 2
1
2
LastLast
  1. #1

    World Markers in code

    Greetings,

    Currently expanding the functions of my own UI, decided to write my own section that handles the world markers. But I cant seem to work out how to get it working, currently tried running a script that does the slash commands "/wm 1" and even "/click CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton" but they all return nil.

    I've check through other world marker like addons, and they have all these complex workarounds that i cant get my head around. any help on making it simple?

    heres a little code snippet

    Code:
    local flagframe = CreateFrame("button", nil, raidutilities)
    flagframe:SetPoint("TOPLEFT", 17, -12)
    flagframe:SetWidth(200)
    flagframe:SetHeight(200)
    flagframe:SetFrameLevel(6)
    for i = 1, 6 do
    flagframe[i] = CreateFrame("button", "flag"..i, flagframe)
    flagframe[i]:SetHeight(50)
    flagframe[i]:SetWidth(50)
    
    flagframe[i]:SetBackdrop(backdrop)
    flagframe[i]:SetBackdropColor(.2, .2, .2, 1)
    
    if i==1 then
    flagframe[i]:SetPoint("TOPLEFT", flagframe)
    else if i == 4 then
    flagframe[i]:SetPoint("LEFT", flagframe[1], "LEFT", 0, -60)
    else
    flagframe[i]:SetPoint("LEFT", flagframe[i-1], "RIGHT", 8, 0)
    end
    end
    
    
    end
    -- blue marker
    flagframe[1]:CreateTexture("bluemark")
    bluemark:SetHeight(40)
    bluemark:SetWidth(40)
    bluemark:SetPoint("CENTER")
    bluemark:SetTexture("Interface\\TARGETINGFRAME\\UI-RaidTargetingIcon_6")
    flagframe[1]:SetScript("OnClick", function(self, button, down)
    SlashCmdList["WM"]("1")
    end)
    
    -- etc etc
    on a side note, InitiateRolePoll() doesnt seem to work. is this a bug? or am i being rather derpy

    thanks!

    Space


    AddOn Author of: SpellNotReadyYet, Rune of Powa

  2. #2
    [Edited]

    Check out the LUA for RaidFlareBinding (which I use) for some pointers, maybe.

    The RaidFlareBinding creates a hidden button to run a macro that does /worldmarker. I think it does it this way because PlaceRaidMarker(index) is protected for some unknown reason--probably outdated but not worth fixing. The hidden button method does not seem to have any taint issues, however.
    Last edited by Malvesti; 2014-02-11 at 08:38 PM.

  3. #3
    Yeah, PlaceRaidMarker is protected.

    A protected function cannot be called programmatically by any code that you write. You can write code that uses secure templates to call protected functions, but that has to originate from a hardware event and the only logic it can use is from macro conditionals.

  4. #4
    bah that sucks. thanks malvesti i will have a look and attempt to understand how the work around works


    AddOn Author of: SpellNotReadyYet, Rune of Powa

  5. #5
    here's a decent intro
    http://wowpedia.org/SecureActionButtonTemplate

    You'll see a "worldmarker" type attribute in the Actions section.

  6. #6
    ah nice, i will go have a play around when i get some spare time. thanks again for the help! i may return if i get stuck :P


    AddOn Author of: SpellNotReadyYet, Rune of Powa

  7. #7
    All you need is a macro button. Macro commands are:

    Code:
    /wm 1 --set world marker 1
    /cwm 1 --clear world marker 1
    /cwm all --clear all

    Making an addon from it can be done via:
    Code:
      ---------------------------
      -- VAR
      ---------------------------
    
      local addon, ns = ...
    
      local previousButton
      local buttonSize = 30
      local stringSize = 14
      local stringIconWorldmarkerPrefix = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_"
    
      local TEX_WORLD_RAID_MARKERS = {
        stringIconWorldmarkerPrefix.."6:"..stringSize..":"..stringSize.."|t",
        stringIconWorldmarkerPrefix.."4:"..stringSize..":"..stringSize.."|t",
        stringIconWorldmarkerPrefix.."3:"..stringSize..":"..stringSize.."|t",
        stringIconWorldmarkerPrefix.."7:"..stringSize..":"..stringSize.."|t",
        stringIconWorldmarkerPrefix.."1:"..stringSize..":"..stringSize.."|t",
      }
    
      local stringIconPassButton = "|TInterface\\Buttons\\UI-GroupLoot-Pass-Up:"..stringSize..":"..stringSize..":0:0|t"
    
      ---------------------------
      -- FUNC
      ---------------------------
    
     --basic button func
      local function CreateBasicButton(parent, name, text, tooltipText)
        local button = CreateFrame("Button", name, parent, "SecureActionButtonTemplate, UIPanelButtonTemplate")
        button.text = _G[button:GetName().."Text"]
        button.text:SetText(text)
        button:SetWidth(buttonSize)
        button:SetHeight(buttonSize)
        button:SetScript("OnEnter", function(self)
          GameTooltip:SetOwner(self, "ANCHOR_TOP")
          GameTooltip:AddLine(tooltipText, 0, 1, 0.5, 1, 1, 1)
          GameTooltip:Show()
        end)
        button:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
        return button
      end
    
      ---------------------------
      -- INIT
      ---------------------------
    
      --create manager frame
      local manager = CreateFrame("Frame", addon, UIParent, "SecureHandlerStateTemplate")
      manager:SetSize(buttonSize,buttonSize)
      manager:SetPoint("CENTER", 0,0)
      --RegisterStateDriver(manager, "visibility", "[group:party][group:raid] show; hide")
    
      --create world marker buttons
      for i=1, #TEX_WORLD_RAID_MARKERS do
        local stringIcon = TEX_WORLD_RAID_MARKERS[i]
        local button = CreateBasicButton(manager, addon.."Button"..i, stringIcon, "WorldMarker"..i)
        button:SetAttribute("type", "macro")
        button:SetAttribute("macrotext", format("/wm %d", i))
        if not previousButton then
          button:SetPoint("CENTER")
        else
          button:SetPoint("TOP", previousButton, "BOTTOM", 0, 0)
        end
        previousButton = button
        local cancelButton = CreateBasicButton(manager, addon.."Button"..i.."Cancel", stringIconPassButton, "Clear WorldMarker"..i)
        cancelButton:SetAttribute("type", "macro")
        cancelButton:SetAttribute("macrotext", format("/cwm %d", i))
        cancelButton:SetPoint("RIGHT", button, "LEFT", 0, 0)
        if i == #TEX_WORLD_RAID_MARKERS then
          local button = CreateBasicButton(manager, addon.."ButtonCancelAll", stringIconPassButton, "Clear all world markers")
          button:SetAttribute("type", "macro")
          button:SetAttribute("macrotext", "/cwm all")
          --alternative
          --button:SetScript("OnClick", ClearRaidMarker)
          button:SetPoint("TOP", previousButton, "BOTTOM", 0, 0)
        end
      end

    You could check out my raid manager mod.
    http://www.wowinterface.com/download...idManager.html
    Last edited by zorker; 2014-02-14 at 10:37 AM.
    | Simple is beautiful.
    | Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

    "I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

  8. #8
    thanks zorker, i got some basic functionality last time with:

    Code:
    local flagframe = CreateFrame("button", nil, raidutilities)
    flagframe:SetPoint("TOPLEFT", 17, -12)
    flagframe:SetWidth(200)
    flagframe:SetHeight(200)
    flagframe:SetFrameLevel(6)
    
    	for i = 1, 6 do
    		flagframe[i] = CreateFrame("button", "flag"..i, flagframe, "SecureActionButtonTemplate")
    		flagframe[i]:SetHeight(50)
    		flagframe[i]:SetWidth(50)
    		flagframe[i]:SetBackdrop(backdrop)
    		flagframe[i]:SetBackdropColor(.2, .2, .2, 1)
    
    			if i==1 then
    				flagframe[i]:SetPoint("TOPLEFT", flagframe)
    			else if i == 4 then
    				flagframe[i]:SetPoint("LEFT", flagframe[1], "LEFT", 0, -60)
    			else
    				flagframe[i]:SetPoint("LEFT", flagframe[i-1], "RIGHT", 8, 0)
    			end
    	end
    
    flagframe[i]:SetAttribute("type1", "macro");
    
    	if i == 6 then
    		flagframe[i]:SetAttribute("macrotext1", "/cwm all");
    	else
    		flagframe[i]:SetAttribute("macrotext1", "/wm "..i);
    	end
    
    end
    plan to add cancel buttons for individual flags (preferably on right click if thats possible?) and maybe some visual indication to say when a flag is currently in use

    on a side note, still cant get InitiateRolePoll() to work, any ideas?


    AddOn Author of: SpellNotReadyYet, Rune of Powa

  9. #9
    If you have a secure button it should work. This is what I do:
    Code:
      --rolecheck button
      local button = CreateBasicButton(manager, addon.."ButtonRoleCheck", "|TInterface\\LFGFrame\\LFGRole:14:14:0:0:64:16:32:48:0:16|t", "Role check")
      button:SetScript("OnClick", InitiateRolePoll)
      button:SetPoint("TOP", previousButton, "BOTTOM", 0, -10)
      previousButton = button
    
      --raid to party button
      local buttonLeft = CreateBasicButton(manager, addon.."ButtonRaidToParty", "|TInterface\\GroupFrame\\UI-Group-AssistantIcon:14:14:0:0|t", "Raid to party")
      buttonLeft:SetScript("OnClick", ConvertToParty)
      buttonLeft:SetPoint("RIGHT", button, "LEFT", 0, 0)
    
      --readycheck button
      local button = CreateBasicButton(manager, addon.."ButtonReady", "|TInterface\\RaidFrame\\ReadyCheck-Ready:14:14:0:0|t", "Ready check")
      button:SetScript("OnClick", DoReadyCheck)
      button:SetPoint("TOP", previousButton, "BOTTOM", 0, 0)
      previousButton = button
    
      --party to raid button
      local buttonLeft = CreateBasicButton(manager, addon.."ButtonPartyToRaid", "|TInterface\\GroupFrame\\UI-Group-LeaderIcon:14:14:0:0|t", "Party to raid")
      buttonLeft:SetScript("OnClick", ConvertToRaid)
      buttonLeft:SetPoint("RIGHT", button, "LEFT", 0, 0)
    | Simple is beautiful.
    | Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

    "I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

  10. #10
    High Overlord Pelf's Avatar
    Join Date
    Mar 2008
    Location
    US-Sargeras
    Posts
    108
    I was curious, so I checked how this addon is starting the ready check. I've been using this one for a while.

    It's just calling DoReadyCheck() directly without any secure frames. So, which of those actually need a secure button and which don't?
    Shiboomi of <Riot> on US-Sargeras

  11. #11
    DoReadyCheck() seems to work fine without being a secure button, will test out the rolecheck soon!

    edit: nope cant seem to get it to work with a secure frame
    Last edited by SpaceDuck; 2014-02-14 at 09:43 PM.


    AddOn Author of: SpellNotReadyYet, Rune of Powa

  12. #12
    No clue. My rolepoll does work. You need Assistant or Leader though to get it working. Do you have that status?
    | Simple is beautiful.
    | Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

    "I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

  13. #13
    yup 100% in a raid and i have leader

    i've tried:

    Code:
    local rolecheck = CreateFrame("button", nil, raidutilities, "SecureActionButtonTemplate")
    makeFrame(rolecheck, "CENTER", -42, -44, backdrop, 81, 30, .7, .7, .7, "HIGH")
    rolecheck:SetHighlightTexture("Interface\\AddOns\\ShadsCore\\Media\\Textures\\fer2.tga")
    rolecheck:SetAttribute("type1", "macro")
    rolecheck:SetAttribute("macrotext1", "/run InitiateRolePoll()")
    rolecheck:GetHighlightTexture() :SetVertexColor(0, .7, .7);
    as well as

    Code:
    local rolecheck = CreateFrame("button", nil, raidutilities)
    makeFrame(rolecheck, "CENTER", -42, -44, backdrop, 81, 30, .7, .7, .7, "HIGH")
    rolecheck:SetHighlightTexture("Interface\\AddOns\\ShadsCore\\Media\\Textures\\fer2.tga")
    rolecheck:GetHighlightTexture() :SetVertexColor(0, .7, .7);
    rolecheck:SetScript("OnClick", InitiateRolePoll)
    but nothing happens, no error but oddly enough the event ROLE_POLL_BEGIN actually fires?


    AddOn Author of: SpellNotReadyYet, Rune of Powa

  14. #14
    Does it work if you simply do /run InitiateRolePoll() in chat?
    UI & AddOns expert | Interface & Macros moderator - My work

  15. #15
    High Overlord Pelf's Avatar
    Join Date
    Mar 2008
    Location
    US-Sargeras
    Posts
    108
    In the base UI, the only place that calls that function is this:
    Code:
    <Button name="$parentInitiateRolePoll" inherits="UIMenuButtonStretchTemplate" text="ROLE_POLL" parentKey="rolePollButton">
    	<Size x="169" y="20"/>
    	<Anchors>
    		<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT" x="20" y="-5"/>
    	</Anchors>
    	<Scripts>
    		<OnClick>
    			PlaySound("igMainMenuOptionCheckBoxOn");
    			InitiateRolePoll();
    		</OnClick>
    	</Scripts>
    </Button>

    UIMenuButtonStretchTemplate is defined in UIPanelTemplates.xml as:
    Code:
    <Button name="UIMenuButtonStretchTemplate" virtual="true">
    So, if I'm reading that correctly, it's not being called from a secure frame in the base UI code, right?
    Shiboomi of <Riot> on US-Sargeras

  16. #16
    InitiateRolePoll is not protected and works fine.

    The OP is probably just seeing the effects of other addons that have essentially made manual role checks obsolete (BigWigs, DBM, ElvUI, ...). As he said, the event is indeed firing.

  17. #17
    Quote Originally Posted by pnutbutter View Post
    InitiateRolePoll is not protected and works fine.

    The OP is probably just seeing the effects of other addons that have essentially made manual role checks obsolete (BigWigs, DBM, ElvUI, ...). As he said, the event is indeed firing.
    hm if this is the case then it might be BigWigs, anyway to disable this? cant find any option in bigwigs (then again titanfall is about to finish downloading )


    AddOn Author of: SpellNotReadyYet, Rune of Powa

  18. #18
    It looks like there's no option to turn it off in BW. If you want to test, turn off your addons except for your new one, and have your party members do the same. Then invite them and click your role check button. Addons aren't suppressing the actual role check, they're just suppressing what you see, especially if everybody already has a role auto-selected.

  19. #19
    confirmed that turning bigwigs off does infact show the role poll. thanks for the help everyone!


    AddOn Author of: SpellNotReadyYet, Rune of Powa

  20. #20
    All we do is unregister the event from the role popup to prevent you having to click "OK" every time someone does it, as we handle role setting automatically. Initiating a role poll has been made redundant by boss mods, but anyone not using one will see your role update request perfectly fine.
    Author of BadBoy, BasicChatMods, BigWigs, oRA3, SexyMap, [...]

    DBM: 21.2 CPU/sec
    BW: 3.7 CPU/sec
    [Source]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •