View Single Post
02/27/14, 02:54 PM   #2
Wykkyd
Are you Wykkyd Gaming?
 
Wykkyd's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 107
Neat addon idea.
Not as simple to implement as one might think.

Tip 1: I wouldn't personally use an XML file for this. It's fairly pointless.

Tip 2: You can get a dynamic list of emotes with something like this:
Code:
local emotes = nil
local LoadEmotes = function() 
	emotes = {}
	for e = 1, GetNumEmotes(), 1 
	do emotes[GetEmoteSlashName(e)] = e end 
end
Tip 3: To draw the 1st frame on screen, sure you could use XML but it'd be just as easy to build a frame using something like this:
Code:
local emoteFrame = WINDOW_MANAGER:CreateTopLevelWindow( "some_unique_name" )
emoteFrame.Background = WINDOW_MANAGER:CreateControl( "another_unique_name", emoteFrame, CT_BACKDROP)
emoteFrame.Label = WINDOW_MANAGER:CreateControl( "another_unique_name", emoteFrame, CT_LABEL)
Then you could go about setting properties of those frames like emoteFrame.Label:SetText( "Emote List" ), etc.


Tip 4: For the pop-up emote list since you want each emote clickable each one will have to be a different unique control, so it'd be best to build a local function that creates a Button with an overlayed Label (Label containing the Emote text). And then make the Button clickable.


Tip 5: Here's the command to issue an emote to be played:
Code:
PlayEmote(emotes[ emoteName ])
  Reply With Quote