WoW:API ScrollingMessageFrame AddMessage: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
m (Move page script moved page API ScrollingMessageFrame AddMessage to API ScrollingMessageFrame AddMessage without leaving a redirect)
 
(11 intermediate revisions by 10 users not shown)
Line 1: Line 1:
<center>'''AddMessage''' ''-Documentation by Jason Citron and Allara-''</center>
{{widgetmethod}}


Outputs text to a local frame in the specified color.
Outputs text to a local MessageFrame, with optional color id.- Updated in 2.4.2


  AddMessage(text, red, green, blue, id);
  MessageFrame:AddMessage(text[,r,g,b[,id][,addToStart]]);


----
== Parameters ==
;''Arguments''
=== Arguments ===


:(String text, Number red, Number green, Number blue, Number id)
:(String text, Number red, Number green, Number blue, Number id, Boolean addToStart)


:;text : The message to output
:;text : The string message to output
:;red : The intensity of the red component. A clamped float between 0.0 and 1.0
:;r : The intensity of the red component. A number between 0.0 and 1.0
:;green : The intensity of the green component. A clamped float between 0.0 and 1.0
:;g : The intensity of the green component. A number between 0.0 and 1.0
:;blue : The intensity of the blue component. A clamped float between 0.0 and 1.0
:;b : The intensity of the blue component. A number between 0.0 and 1.0
:;id : A number that classifies the line of text, for later changing the color
:;id : A number that classifies the line of text, for later changing the color
:;addToStart : Boolean - Set to true to add the message to the start of the MessageFrame as if it was the first printed message - New in 2.4.2.


----
=== Returns ===
;''Returns''
:;nil
 
 
== Example ==


:;nil
DEFAULT_CHAT_FRAME:AddMessage("Testing", 1.0, 0.0, 0.0);
 
Outputs "Testing" on a single line in your default chat window -- in red.
 
DEFAULT_CHAT_GLOBAL:AddMessage("AddOn Loaded!", 0.0, 1.0, 0.0, nil, true);
 
Outputs "AddOn Loaded!" at the start of your default chat window -- in green.


----
==Escape Sequences==
;''Example''
It is also possible to control the text of parts of lines in the MessageFrame with escape sequences in text.
AddMessage("Testing", 1.0, 0.0, 0.0);


;''Result''
<div style="margin-left:3%;">
  Testing -- in red
===Set color===
Syntax:
'''|c'''AARRGGBB  colored text 
Example:
  '''|c'''FFFF0000This Will Be In Red


----
===Reset color===
;''Description''
Syntax:
|cAARRGGBB  colored text  '''|r'''  uncolored text
Example:
|cFF00FF00In Green'''|r'''Default Color


Any of the parameters after text are optional. ID is used internally by the chat system, in order to provide a way to later customize the color of specific lines in the chat window. By tying each type of chat to a unique ID, the ColorPicker's colorFunc can use UpdateColorByID to dynamically change the color of the lines. There does not appear to be a way to influence the alpha of chat lines, or to change or duplicate the behavior of the ScrollingMessageFrame's fading out ability. --[[User:Allara|Allara]] 02:38, 16 May 2005 (EDT)
</div>


----
==See also==
{{Template:WoW API}}
*[[UI Escape Sequences]]

Latest revision as of 04:47, 15 August 2023

Widget API ← ScrollingMessageFrame < AddMessage

Outputs text to a local MessageFrame, with optional color id.- Updated in 2.4.2

MessageFrame:AddMessage(text[,r,g,b[,id][,addToStart]]);

Parameters[edit]

Arguments[edit]

(String text, Number red, Number green, Number blue, Number id, Boolean addToStart)
text
The string message to output
r
The intensity of the red component. A number between 0.0 and 1.0
g
The intensity of the green component. A number between 0.0 and 1.0
b
The intensity of the blue component. A number between 0.0 and 1.0
id
A number that classifies the line of text, for later changing the color
addToStart
Boolean - Set to true to add the message to the start of the MessageFrame as if it was the first printed message - New in 2.4.2.

Returns[edit]

nil


Example[edit]

DEFAULT_CHAT_FRAME:AddMessage("Testing", 1.0, 0.0, 0.0);

Outputs "Testing" on a single line in your default chat window -- in red.

DEFAULT_CHAT_GLOBAL:AddMessage("AddOn Loaded!", 0.0, 1.0, 0.0, nil, true);

Outputs "AddOn Loaded!" at the start of your default chat window -- in green.

Escape Sequences[edit]

It is also possible to control the text of parts of lines in the MessageFrame with escape sequences in text.

Set color[edit]

Syntax:

|cAARRGGBB  colored text  

Example:

|cFFFF0000This Will Be In Red

Reset color[edit]

Syntax:

|cAARRGGBB  colored text  |r  uncolored text

Example:

|cFF00FF00In Green|rDefault Color

See also[edit]