View Single Post
05-20-17, 01:56 PM   #3
Asalas77
A Murloc Raider
Join Date: May 2017
Posts: 9
Ok so here's the full code.

lfg.lua
Lua Code:
  1. -- Author      : adamz
  2. -- Create Date : 5/20/2017 2:16:57 PM
  3. function OnLoad()
  4.      Main:Show();
  5.      local line = Main:CreateTexture()
  6.     line:SetTexture(.6 ,.6, .6, .4)
  7.     line:SetSize(170, 1)
  8.     line:SetPoint("TOP", 0,-207.5)
  9.  
  10. end
  11.  
  12. function MinimapButton_OnClick()
  13.       if not Main:IsVisible() then
  14.          Main:Show();
  15.      else
  16.          Main:Hide();
  17.      end
  18. end
  19.  
  20. SLASH_LFGSHOW1 = '/lfg';
  21. function SlashCmdList.LFGSHOW()
  22. Main:Show();
  23. end
  24.  
  25.  
  26. -- RAID SETTINGS --
  27.  
  28. raids = {'Naxxramas','Vault of Archavon','Obsidian Sanctum','Ulduar','The Eye of Eternity','Trial of the Crusader','Onyxia\'s Lair','Icecrown Citadel','Ruby Sanctum'}
  29. raid_values ={'naxx','voa','os','uldu','eoe','toc','onyxia','icc','rs'}
  30.  
  31. local raid;
  32. local raidSize =10;
  33. local tank =2;
  34. local heal = 2;
  35. local dps = 6;
  36.  
  37. local dropDown = CreateFrame("Frame", "raidDrop", Main, "UIDropDownMenuTemplate")
  38. dropDown:SetPoint("TOPLEFT",0,0)
  39. UIDropDownMenu_SetWidth(dropDown, 80)
  40. UIDropDownMenu_SetText(dropDown,raid)
  41.  
  42. UIDropDownMenu_Initialize(dropDown, function(self, level, menuList)
  43.  local info = UIDropDownMenu_CreateInfo()
  44.   for i=1,9 do
  45.    info.text, info.arg1, info.checked = raids[i], raid_values[i], false
  46.     info.func = self.SetValue
  47.    UIDropDownMenu_AddButton(info)
  48.  end
  49. end)
  50.  
  51. function dropDown:SetValue(newValue)
  52.  raid = newValue
  53.  UIDropDownMenu_SetText(dropDown,raid)
  54.  CloseDropDownMenus()
  55. end
  56.  
  57.  
  58. function updateCount()
  59.     tankCount:SetText(tostring(tank));
  60.     healCount:SetText(tostring(heal));
  61.     dpsCount:SetText(tostring(dps));
  62. end
  63.  
  64.  function Button10_OnClick()
  65.     raidSize = 10;
  66.     tank = 2;
  67.     heal = 2;
  68.     dps = 6;
  69.     updateCount();
  70. end
  71.  
  72. function Button25_OnClick()
  73.     raidSize = 25;
  74.     tank = 2;
  75.     heal = 5;
  76.     dps = 17;
  77.     updateCount();
  78. end
  79.  
  80.  function tankMinus_OnClick()
  81.  tank = tank -1;
  82. updateCount();
  83.  end
  84.  
  85. function tankPlus_OnClick()
  86.  tank = tank +1;
  87. updateCount();
  88.  end
  89.  
  90. function healMinus_OnClick()
  91.  heal = heal -1;
  92. updateCount();
  93. end
  94.  
  95.  function healPlus_OnClick()
  96.   heal = heal +1;
  97. updateCount();
  98.  end
  99.  
  100. function dpsMinus_OnClick()
  101.  dps = dps -1;
  102. updateCount();
  103.  end
  104.  
  105. function dpsPlus_OnClick()
  106.  dps = dps +1;
  107. updateCount();
  108.  end
  109.  
  110. function sendButton_OnClick()
  111. msg = dropDown:GetValue() .. raidSize .. 'need ' .. tank .. 'x tank, ' .. heal .. 'x heal' .. 'x dps' .. '';
  112.     SendChatMessage(msg,"CHANNEL", DEFAULT_CHAT_FRAME.editBox.languageID, GetChannelName(channel:GetText()));
  113. end


lfg.xml
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Script file="lfg.lua" />
 <Frame name="Main" movable="true" enableMouse="true">
		<Size x="200" y="325" />
		<Anchors>
			<Anchor point="CENTER" x="0" y="0" />
		</Anchors>
		<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
			<BackgroundInsets>
				<AbsInset left="10" right="10" top="10" bottom="10" />
			</BackgroundInsets>
			<TileSize>
				<AbsValue val="32" />
			</TileSize>
			<EdgeSize>
				<AbsValue val="32" />
			</EdgeSize>
		</Backdrop>
		<Layers>
			<Layer level="OVERLAY">
				<FontString inherits="GameFontNormalSmall" text="Raid">
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-20" />
					</Anchors>
				</FontString>
				
				
				
				<FontString inherits="GameFontNormalSmall" text="Tank">
					<FontHeight val="10"/>
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-60" />
					</Anchors>
				</FontString>
				<FontString inherits="GameFontNormalSmall" text="Heal">
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-80" />
					</Anchors>
				</FontString>
				<FontString inherits="GameFontNormalSmall" text="Dps">
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-100" />
					</Anchors>
				</FontString>
				
				
				
				
				<FontString inherits="GameFontNormalSmall" text="Min GS">
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-160" />
					</Anchors>
				</FontString>
				<FontString inherits="GameFontNormalSmall" text="Info">
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-180" />
					</Anchors>
				</FontString>
				<FontString inherits="GameFontNormalSmall" text="Teamspeak">
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-140" />
					</Anchors>
				</FontString>
				
				
				
				<FontString inherits="GameFontNormalSmall" text="Channel name">
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-220" />
					</Anchors>
				</FontString>
				<FontString inherits="GameFontNormalSmall" text="Auto send">
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-240" />
					</Anchors>
				</FontString>
				<FontString inherits="GameFontNormalSmall" text="Msg delay">
					<Anchors>
						<Anchor point="TOPLEFT" x="20" y="-260" />
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		<Frames>
		
			<Button name="10_Button" inherits="UIPanelButtonTemplate" text="10">
					<Size x="30" y="15" />	<NormalFont style="GameFontNormalSmall"/>
				
					<Anchors>
						<Anchor point="TOPLEFT" x="100" y="-40" />
					</Anchors>
					<Scripts>
						<OnClick>
							Button10_OnClick()
						</OnClick>
					</Scripts>
				</Button>
			<Button name="25_Button" inherits="UIPanelButtonTemplate" text="25">
					<Size x="30" y="15" />
					<NormalFont style="GameFontNormalSmall"/>
					<Anchors>
					
						<Anchor point="TOPLEFT" x="140" y="-40" />
					</Anchors>
					<Scripts>
						<OnClick>
							Button25_OnClick()
						</OnClick>
					</Scripts>
				</Button>
			<Button name="tankMinus" inherits="UIPanelButtonTemplate" text="-">
				<Size x="15" y="15" />
				<Anchors>
					<Anchor point="TOPLEFT" x="100" y="-60" />
				</Anchors>
				<Scripts>
					<OnClick>
						tankMinus_OnClick()
					</OnClick>
				</Scripts>
			</Button>
			<Button name="tankPlus" inherits="UIPanelButtonTemplate" text="+">
				<Size x="15" y="15" />
				<Anchors>
					<Anchor point="TOPLEFT" x="160" y="-60" />
				</Anchors>
				<Scripts>
					<OnClick>
						tankPlus_OnClick()
					</OnClick>
				</Scripts>
			</Button>
			<Button name="healMinus" inherits="UIPanelButtonTemplate" text="-">
				<Size x="15" y="15" />
				<Anchors>
					<Anchor point="TOPLEFT" x="100" y="-80" />
				</Anchors>
				<Scripts>
					<OnClick>
						healMinus_OnClick()
					</OnClick>
				</Scripts>
			</Button>
			<Button name="healPlus" inherits="UIPanelButtonTemplate" text="+">
				<Size x="15" y="15" />
				<Anchors>
					<Anchor point="TOPLEFT" x="160" y="-80" />
				</Anchors>
				<Scripts>
					<OnClick>
						healPlus_OnClick()
					</OnClick>
				</Scripts>
			</Button>
			<Button name="dpsMinus" inherits="UIPanelButtonTemplate" text="-">
				<Size x="15" y="15" />
				<Anchors>
					<Anchor point="TOPLEFT" x="100" y="-100" />
				</Anchors>
				<Scripts>
					<OnClick>
						dpsMinus_OnClick()
					</OnClick>
				</Scripts>
			</Button>
			<Button name="dpsPlus" inherits="UIPanelButtonTemplate" text="+">
				<Size x="15" y="15" />
				<Anchors>
					<Anchor point="TOPLEFT" x="160" y="-100" />
				</Anchors>
				<Scripts>
					<OnClick>
						dpsPlus_OnClick()
					</OnClick>
				</Scripts>
			</Button>
			<Button name="closeButton" inherits="UIPanelButtonTemplate" text="Close">
				<Size x="80" y="20" />	<NormalFont style="GameFontNormalSmall"/>
				
				<Anchors>
					<Anchor point="TOPLEFT" x="100" y="-290" />
				</Anchors>
				<Scripts>
					<OnClick>
						MinimapButton_OnClick()
					</OnClick>
				</Scripts>
			</Button>
			<Button name="sendButton" inherits="UIPanelButtonTemplate" text="Send">
				<Size x="80" y="20" />	<NormalFont style="GameFontNormalSmall"/>
				
				<Anchors>
					<Anchor point="TOPLEFT" x="20" y="-290" />
				</Anchors>
				<Scripts>
					<OnClick>
						sendButton_OnClick();
					</OnClick>
				</Scripts>
			</Button>
			
			<EditBox name="tankCount" autoFocus="false" inherits="InputBoxTemplate">
			  <Size x="20" y="20" /> 
				<Anchors>
					<Anchor point="TOPLEFT" x="130" y="-57.5" /> 
				</Anchors> 
			 </EditBox>
			<EditBox name="healCount" autoFocus="false" inherits="InputBoxTemplate">
				 <Size x="20" y="20" /> 
				<Anchors>
					<Anchor point="TOPLEFT" x="130" y="-77.5" /> 
				</Anchors> 
			 </EditBox>
			<EditBox name="dpsCount" autoFocus="false" inherits="InputBoxTemplate"> 
				 <Size x="20" y="20" /> 
				 <Anchors> 
				 <Anchor point="TOPLEFT" x="130" y="-97.5" />
				 </Anchors> 
			 </EditBox> 
			<EditBox name="delay" autoFocus="false" inherits="InputBoxTemplate">
				<Size x="20" y="20" />
				 <Anchors> 
				 <Anchor point="TOPLEFT" x="130" y="-257.5" /> 
			 </Anchors> 
			 </EditBox> 
			<EditBox name="gs" autoFocus="false" inherits="InputBoxTemplate">
				<Size x="40" y="20" />
				 <Anchors> 
				 <Anchor point="TOPLEFT" x="120" y="-157.5" /> 
			 </Anchors> 
			 </EditBox> 
			<EditBox name="info" autoFocus="false" inherits="InputBoxTemplate">
				<Size x="80" y="20" />
				 <Anchors> 
				 <Anchor point="TOPLEFT" x="100" y="-177.5" /> 
			 </Anchors> 
			 </EditBox> 
			<EditBox name="channel" autoFocus="false" inherits="InputBoxTemplate">
				<Size x="80" y="20" />
				 <Anchors> 
				 <Anchor point="TOPLEFT" x="100" y="-217.5" /> 
			 </Anchors> 
			 </EditBox> 
		
			 <CheckButton name="teamspeakCheck" inherits="UICheckButtonTemplate" id="1"> 
				 <Size x="20" y="20" /> 
				<Anchors> 
					 <Anchor point="TOPLEFT" x="127.5" y="-137.5" /> 
			 </Anchors> 
			</CheckButton> 
			 <CheckButton name="autosendCheck" inherits="UICheckButtonTemplate" id="2"> 
				 <Size x="20" y="20" /> 
				<Anchors> 
				<Anchor point="TOPLEFT" x="127.5" y="-237.5" />
				 </Anchors> 
			</CheckButton> 

		</Frames>
		<Scripts>
				<OnLoad>
				tinsert(UISpecialFrames, self:GetName());
				OnLoad();
				self:RegisterForDrag("LeftButton");
				tankCount:SetScript("OnEscapePressed", function(self)
						 self:ClearFocus()
						end)
				healCount:SetScript("OnEscapePressed", function(self)
						self:ClearFocus()
						end)
				dpsCount:SetScript("OnEscapePressed", function(self)
						self:ClearFocus()
						end)
			</OnLoad>
		<OnDragStart> 
				self:StartMoving();
			</OnDragStart>
			<OnDragStop>
				self:StopMovingOrSizing();
			</OnDragStop>
		</Scripts>
	</Frame>
	
	<Button name="MinimapButton" parent="Minimap" movable="true" enableMouse="true">
		<Size>
			<AbsDimension x="33" y="33" />
		</Size>
		<Anchors>
			<Anchor point="TOPLEFT" />
		</Anchors>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture name="MyMod_MinimapButton_Icon" file="Interface\Icons\INV_Misc_QuestionMark">
					<Size>
						<AbsDimension x="21" y="21" />
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT">
							<Offset>
								<AbsDimension x="7" y="-6" />
							</Offset>
						</Anchor>
					</Anchors>
				</Texture>
			</Layer>
			<Layer level="OVERLAY">
				<Texture file="Interface\Minimap\MiniMap-TrackingBorder">
					<Size>
						<AbsDimension x="56" y="56" />
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT" />
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad>
				this:RegisterForClicks("LeftButtonUp","RightButtonUp")
				</OnLoad>
			<OnClick>
				MinimapButton_OnClick()
			</OnClick>
		</Scripts>
		<HighlightTexture file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight" alphaMode="ADD" />
	</Button>
</Ui>
That's it.

Sorry if this is some basic stuff I'm missing, I just started learning lua today.