Difference between revisions of "AddColorMarker"

From King Arthur's Gold Wiki
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
This defines a token (e.g. $RED$) for colouring text in menus and suchlike.
 
This defines a token (e.g. $RED$) for colouring text in menus and suchlike.
 
</onlyinclude>
 
</onlyinclude>
 +
 
It takes a string representing the token to be replaced and a colour (as an [[SColor]]) to give the text.
 
It takes a string representing the token to be replaced and a colour (as an [[SColor]]) to give the text.
 
Text following the token will be given the colour assigned to the token.
 
Text following the token will be given the colour assigned to the token.
<syntaxhighlight lang="cpp">void AddColorMarker( const string &token, SColor color )</syntaxhighlight>
+
<syntaxhighlight lang="cpp">
 +
void AddColorToken( const string &token, SColor color )
 +
</syntaxhighlight>
  
 
Example from Scripts/autostart.as:
 
Example from Scripts/autostart.as:
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
AddColorMarker( "$RED$", SColor(255, 105, 25, 5) );
+
AddColorToken( "$RED$", SColor(255, 105, 25, 5) );
 
</syntaxhighlight>
 
</syntaxhighlight>
This colour marker means that whenever $RED$ is included in menu text, following text will be coloured red.
+
This colour token means that whenever $RED$ is included in menu text, any following text will be coloured red.
  
 
[[Category:Scripting]]
 
[[Category:Scripting]]
 
[[Category:Global Functions]]
 
[[Category:Global Functions]]

Latest revision as of 15:03, 20 August 2012

This defines a token (e.g. $RED$) for colouring text in menus and suchlike.


It takes a string representing the token to be replaced and a colour (as an SColor) to give the text. Text following the token will be given the colour assigned to the token.

void AddColorToken( const string &token, SColor color )

Example from Scripts/autostart.as:

AddColorToken( "$RED$", SColor(255, 105, 25, 5) );

This colour token means that whenever $RED$ is included in menu text, any following text will be coloured red.