View Single Post
08-14-13, 01:53 AM   #7
Lazare
An Aku'mai Servant
 
Lazare's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 36
Originally Posted by Choonstertwo View Post
Define your buttons in XML like this:
Code:
<Button name="LeiShenCoordinator_BlueMarker" inherits="UIPanelButtonTemplate,SecureActionButtonTemplate" text="Blue">
	<Size>
		<AbsDimension x="50" y="23" />
	</Size>
	<Anchors>
		<Anchor point="TOPLEFT">
			<Offset x="25" y="-75" />
		</Anchor>
	</Anchors>
	<FontHeight>
		<AbsValue val="12" />
	</FontHeight>
	<Color r="0" g="0" b="1" />
	<Scripts>
		<OnLoad>
			LeiShenCoordinator_MarkerOnLoad(self, "bluesquare")
		</OnLoad>
	</Scripts>
</Button>
And your initialisation code in Lua like this:
lua Code:
  1. local markerIndexes = {
  2.     bluesquare = 1,
  3.     greentriangle = 2,
  4.     purplediamond = 3,
  5.     redcross = 4,
  6.     yellowstar = 5,
  7. }
  8.  
  9. function LeiShenCoordinator_MarkerOnLoad(self, marker)
  10.     local index = markerIndexes[marker]
  11.    
  12.     -- Set world marker on left-click:
  13.     self:SetAttribute("type1", "worldmarker")
  14.     self:SetAttribute("marker1", index)
  15.     self:SetAttribute("action1", "set")
  16.    
  17.     -- Clear world marker on right-click:
  18.     self:SetAttribute("type2", "worldmarker")
  19.     self:SetAttribute("marker2", index)
  20.     self:SetAttribute("action2", "clear")
  21. end
Thanks again for this. I have it placed in my Lua just fine and placing markers works great. Using the right click to try to clear a marker does not work though. I have spent the last few hours trying find another way of clearing them all (including macrotext) but am getting stumped again sadly. I have made the changed to a better naming as was said by Phanx (TY!). But other than that it is bugging me.
Thanks
  Reply With Quote