Thread Tools Display Modes
11-29-10, 04:03 AM   #1
Sideshow
A Flamescale Wyrmkin
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 103
Opening editbox in chat

Hello

I would like a lua function that will open the edit box of the chat and
automatically type "/tdps whisper <name>"
I don't want to make another frame just to enter a name ...

Any idea how to do it, if possible at all?

Thanks
  Reply With Quote
11-29-10, 04:04 AM   #2
Nobgul
A Molten Giant
 
Nobgul's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 693
Originally Posted by Sideshow View Post
Hello

I would like a lua function that will open the edit box of the chat and
automatically type "/tdps whisper <name>"
I don't want to make another frame just to enter a name ...

Any idea how to do it, if possible at all?

Thanks
Check out SEND_CHAT_MESSAGE
__________________
[SIGPIC][/SIGPIC]
  Reply With Quote
11-29-10, 04:05 AM   #3
Sideshow
A Flamescale Wyrmkin
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 103
That was pretty quick But that's not what I need. I need to explain myself better.
The user needs to be able to manually change "<name>"
  Reply With Quote
11-29-10, 04:16 AM   #4
Nobgul
A Molten Giant
 
Nobgul's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 693
Originally Posted by Sideshow View Post
That was pretty quick But that's not what I need. I need to explain myself better.
The user needs to be able to manually change "<name>"
/script SendChatMessage("Hello Bob!", "WHISPER", "Common", "Bob");
__________________
[SIGPIC][/SIGPIC]
  Reply With Quote
11-29-10, 04:16 AM   #5
Nobgul
A Molten Giant
 
Nobgul's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 693
I mean it depends in the situation you are going to use it in. If you gave a bit more info on the way you intend to use it, I may have a better idea.
__________________
[SIGPIC][/SIGPIC]
  Reply With Quote
11-29-10, 04:23 AM   #6
Sideshow
A Flamescale Wyrmkin
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 103
I know how to send a message with lua, that's not the problem.

I just want to know how to open the editbox and automatically put some text in it.
This, instead of making another dialog box to ask for user input...

Context: whispering damage report to another user via a command, the name of the user is variable.
  Reply With Quote
11-29-10, 06:01 AM   #7
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 115
Code:
local eb = DEFAULT_CHAT_FRAME.editBox
ChatEdit_ActivateChat(eb)
eb:Insert(the crap that you want to show up in the editbox)
Try playing with this.
  Reply With Quote
11-29-10, 06:58 AM   #8
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Why don't you just use slash command handler for /tdps? The SlashCmdList table is global.

SlashCmdList["<tdps index name>"]("<tdps args>")
  Reply With Quote
11-29-10, 07:36 AM   #9
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
He only wanted a function to put in the text in the chat box and do nothing more, so here you go mate:

Code:
local function putInChatBox(name)
  name = type(name) ~= "string" and "" or name
  local e = DEFAULT_CHAT_FRAME.editBox
  ChatEdit_ActivateChat(e)
  e:SetText("/tdps whisper "..name)
end

-- example: putInChatBox("Vladinator")
The first line makes sure the param is a string, if not it uses a empty string so the function still works.

Last edited by Vlad : 11-29-10 at 07:38 AM.
  Reply With Quote
11-29-10, 02:17 PM   #10
Sideshow
A Flamescale Wyrmkin
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 103
Thanks a lot
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Opening editbox in chat

Thread Tools
Display Modes

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