API:SendChatText
From RoR Wiki
UI Lua API · Chat functions
Version: WAR 1.4.8
Sends a line of chat text or a slash command, exactly as if the player had typed it.
SendChatText(text, channel)
Arguments
- text
wstring– The text or slash command, for exampleL"/afk"orL"Hello".- channel
wstring– Channel command to put in front oftext, for exampleL"/guild", orL"".
Returns
Nothing.
Details
- Only one call per frame is processed. The client remembers the frame of the last call; any further call in the same frame is ignored, even if its arguments are wrong. Spread several commands over several frames (for example with an
OnUpdatehandler). - If
textis empty, nothing happens. textis first handled on its own as a chat command. If it is not handled that way, the client buildschannel.." "..text, or"/say "..textwhenchannelis empty, and handles that. The built line is limited to 1050 characters.- The stock UI uses this function both for normal chat (passing the current channel's server command) and for many slash commands with an empty channel.
- The function needs at least two arguments and only reads the last two.
Errors
None besides the generic Invalid Parameters message when an argument is not a wide string.
Example
Sending a slash command, from default/ea_socialwindow/source/socialwindowtaboptions.lua:
SendChatText( L"/afk "..afkNote, L"" )
Sending what the player typed to the current channel, from default/ea_chatwindow/source/chatwindow.lua:
if( chatText ~= L"" )
then
SendChatText( chatText, chatChannel )
end
