Thread Tools Display Modes
02/27/14, 05:57 AM   #1
raykai
 
raykai's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 16
trying to do my 1st LUA addon

hi im new to doing addons but i would like to try and do one.

but il need your help to get on track

what i need help with is:

im trying to do a icon that is above the chat box that has the name Emote

ones you click on it it would show a frame with all the list of Emote that would be clickable on click it would send the / event in the chat.

so far i did

one file named emote_list.txt
code:
Code:
## Title: Emote list
## APIVersion: 100000

emote_list.lua
emote_list.xml
then i have my two files:
emote_list.lua
emote_list.xml

now from there im not sheer how to get my frame with the emote list...
should i create a frame in the xml file ?

and do a list of the in game emots scrip list in the lua file ?

if i could get a short example of doing a frame with text in it that on click it would past that text in chat i think i could manage the rest.
  Reply With Quote
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

ESOUI » Developer Discussions » General Authoring Discussion » trying to do my 1st LUA addon


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off