SC2Mapster.com Wiki

StringToText

text StringToText(string value);

Convert a formatted string to a text.

Parameters

string value

String to convert to text. Available tags:

Color
  • <c>colored</c>: Colored text: default color.
  • <c val="ff00ff">colored</c>: Colored text. The color is in hexadecimal (Red, Green, Blue)
  • <c val="255,0,255">colored</c>: You may also use (r,g,b) values of a color and not just a hexadecimal code
  • <c val="#ColorRed">colored</c>: In addition to the first two you can also use Starcraft II's constant values. See Color Constants
  • <h>highlight</h>: The text inside will be with the "highlight" color. There's different highlight colors depending on the style template the text is in.
Size
  • <s>small</s>: Makes text small.
  • <h2>big</h2>: Makes text big.
  • <n />: New line
  • <n>text</n>: The text inside the tags will be in a new line, in addition to make a new line after it.
Image
  • <img path="Assets\Textures\btn-ability-zerg-sporecloud.dds" width="200" height="300" color="ff00ff" />: Show an image with specific dimensions and color altered.

Return value

text - Text value

Examples

Example: Color
string colored = "";
colored += "<c val=\"ff0000\">C</c>";
colored += "<c val=\"00ff00\">o</c>";
colored += "<c val=\"0000ff\">l</c>";
colored += "<c val=\"ffff00\">o</c>";
colored += "<c val=\"ff00ff\">r</c>";
colored += "<c val=\"00ffff\">e</c>";
colored += "<c val=\"127,127,127\">d</c>";

TriggerDebugOutput(1, StringToText(colored), true);

string image = "<img path=\"Assets\\Textures\\btn-ability-zerg-sporecloud.dds\" />";
TriggerDebugOutput(1, StringToText(image), true);
  • colored.PNG
  • Screenshot.Jpg

You must login to post a comment. Don't have an account? Register to get one!

  • 3 comments
  • Avatar of makeroflight makeroflight Jun 17, 2011 at 20:26 UTC - 0 likes

    Can you port in your own images to do this in game?

  • Avatar of Genopath Genopath Mar 24, 2010 at 03:06 UTC - 0 likes

    Color is still in hexidecimal, I see. I hope the galaxy editor have an easy way of coloring strings and tooltips unlike War where one had to use "|colorcode|r respecitvely.

    In any case, I would love to have a colorizer for StarCraft 2 as well.

    Last edited Mar 24, 2010 by Genopath
  • Avatar of xcorbo xcorbo Mar 19, 2010 at 07:15 UTC - 0 likes

    During my tests I literally tried all letters. I found three types of "tags", the ones that made text look like <b val="32">text</b> that I called "tags that break". I also found that some letters that the text looked like normal text (no <b whatever>text</b>). The letters that don't break are: a, d, l, u and w. In additiong <font></font> doesn't break either. And third, I found the tags that work. Which are listed above. <c> <h> <n>...

  • 3 comments

Facts

Date created
Mar 14, 2010
Last updated
Apr 03, 2010