Is there a way to make them a different color?
NPC Floaty Names
Débuté par
Jenna WSI
, oct. 27 2011 09:23
#1
Posté 27 octobre 2011 - 09:23
#2
Posté 27 octobre 2011 - 09:36
This is the script im using for colored text, and im pretty happy with it.
It might seem complicated but you don't really have to know how it works. Anyhow, make sure you have this script included on your OnModuleLoad and call for SetColors(). After that you can use custom tokens from 6000 to 7000 to create colored text.
Think of it as 6RGB; (google RGB incase you dont know what it means)
6900 = bright red
6005 = dark blue
6963 = orange
etc...
7000 is used to stop colored text. (normal text coloring kicks in)
Incase you don't know what custom tokens are... Well, its really simple. Basically you write <CUSTOM#> where # is a number, and the whole thing will be replaced by something.
EDIT
This forum's colored text fails so hard..........
Anyhow, for example, if you want half of the name to be green and the other half cyan, just type this in the creatures name field. Just play around with it, its really simple.
<CUSTOM6090>Crea<CUSTOM6099>ture<CUSTOM7000>
The 7000 isn't needed in creature names, but you might have use for it in places like journal and item descriptions.
const string COLORTOKEN = " ##################$%&'()*+,-./0123456789:;;==?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[]^_`abcdefghijklmnopqrstuvwxyz{|}~~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ¡¡¢£¤¥¦§¨©ª«¬¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþþ";
// returns a properly color-coded sText string based on specified RGB values
// ends color mode after sText if iEnd = 1
string ColorString(string sText, int nRed=255, int nGreen=255, int nBlue=255, int iEnd = 0);
string ColorString(string sText, int nRed=255, int nGreen=255, int nBlue=255, int iEnd = 0)
{
string sEnd = "";
if (iEnd == 1) {sEnd = "</c>";}
return "<c" + GetSubString(COLORTOKEN, nRed, 1) + GetSubString(COLORTOKEN, nGreen, 1) + GetSubString(COLORTOKEN, nBlue, 1) + ">" + sText + sEnd;
}
void SetColors();
void SetColors()
{
int r=0,g=0,b=0, in;
while (1)
{
SetCustomToken(6000 + r*100 + g*10 + b*1, ColorString("", r*28+3, g*28+3, b*28+3));
if ((r == 9) && (g == 9) && (b == 9)) {break;}
else if ( (g == 9) && (b == 9)) {r++; g=0; b=0;}
else if ( (b == 9)) { g++; b=0;}
else { b++;}
in++;
}
DelayCommand(3.0, FloatingTextStringOnCreature(IntToString(in), GetFirstPC()));
SetCustomToken(7000, "</c>");
}It might seem complicated but you don't really have to know how it works. Anyhow, make sure you have this script included on your OnModuleLoad and call for SetColors(). After that you can use custom tokens from 6000 to 7000 to create colored text.
Think of it as 6RGB; (google RGB incase you dont know what it means)
6900 = bright red
6005 = dark blue
6963 = orange
etc...
7000 is used to stop colored text. (normal text coloring kicks in)
Incase you don't know what custom tokens are... Well, its really simple. Basically you write <CUSTOM#> where # is a number, and the whole thing will be replaced by something.
EDIT
This forum's colored text fails so hard..........
Anyhow, for example, if you want half of the name to be green and the other half cyan, just type this in the creatures name field. Just play around with it, its really simple.
<CUSTOM6090>Crea<CUSTOM6099>ture<CUSTOM7000>
The 7000 isn't needed in creature names, but you might have use for it in places like journal and item descriptions.
Modifié par Xardex, 27 octobre 2011 - 09:47 .
#3
Posté 27 octobre 2011 - 10:19
Awesome! We have some colored tokens in already so I'll try this out.
#4
Posté 28 octobre 2011 - 09:27
I didn't notice it earlier but the following stuff are there just for debugging:
int r=0,g=0,b=0[u], in[/u]; ... in++; ... DelayCommand(3.0, FloatingTextStringOnCreature(IntToString(in), GetFirstPC()));





Retour en haut






