WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Opening editbox in chat (https://www.wowinterface.com/forums/showthread.php?t=37180)

Sideshow 11-29-10 04:03 AM

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

Nobgul 11-29-10 04:04 AM

Quote:

Originally Posted by Sideshow (Post 220488)
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

Sideshow 11-29-10 04:05 AM

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>"

Nobgul 11-29-10 04:16 AM

Quote:

Originally Posted by Sideshow (Post 220490)
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");

Nobgul 11-29-10 04:16 AM

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.

Sideshow 11-29-10 04:23 AM

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.

Dainton 11-29-10 06:01 AM

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.

Waverian 11-29-10 06:58 AM

Why don't you just use slash command handler for /tdps? The SlashCmdList table is global.

SlashCmdList["<tdps index name>"]("<tdps args>")

Vlad 11-29-10 07:36 AM

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. ;)

Sideshow 11-29-10 02:17 PM

Thanks a lot


All times are GMT -6. The time now is 02:58 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI