Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

TokenExample TextOutput ExampleDescription and Notes
<Alignment>Why would someone of <alignment> persuasion do this?Why would someone of Chaotic Neutral persuasion do this?
<alignment>Curse you and your <alignment> nature!Curse you and your chaotic neutral nature!
<Boy/Girl><Boy/Girl> you will listen to me and sit down!Girl you will listen to me and sit down!
<boy/girl>What do you say, <boy/girl>?What do you say, girl?
<Brother/Sister>Welcome to our temple, <Brother/Sister>!Welcome to our temple, Sister!
<brother/sister>Well that'd make you kinda like a little <brother/sister>, wouldn't it?Well that'd make you kinda like a little sister, wouldn't it?
<Class>We need training staff. <Class> trainer would be your job, how about it?We need training staff. Wizard trainer would be your job, how about it?Uses the first class lot, so "unreliable" after level 1. Uses classes.2da tlk reference.
<class>A <class> eh? Welcome aboard!A wizard eh? Welcome aboard!Uses the first class slot, so "unreliable" after level 1. Uses classes.2da tlk reference made lowercase
<Day/Night><Day/Night>times like this makes this all worthwhile.Daytimes like this make this all worthwhile.

Day is defined as:

Night is defined as:

<day/night>What a blasted <day/night>!What blasted day!
<Deity>For <Deity>'s sake!For Erevan Illesre's sake!The text-field "Deity" - also retrievable by GetDeity but otherwise unused by the engine (can be set with SetDeity)
<FirstName>

May change based on the language
<FullName>


<GameMonth>


<GameTime>


<GameYear>


<Good/Evil>


<good/evil>


<He/She>


<he/she>


<Him/Her>


<him/her>


<His/Her>


<his/her>


<His/Hers>


<his/hers>


<Lad/Lass>


<lad/lass>


<LastName>


<Lawful/Chaotic>


<lawful/chaotic>


<Law/Chaos>


<law/chaos>


<Level>You're at level <Level>.You're at level 14.Equivalent to GetHitDice
<Lord/Lady>


<lord/lady>


<Male/Female>


<male/female>


<Man/Woman>


<man/woman>


<Master/Mistress>


<master/mistress>


<Mister/Missus>


<mister/missus>


<PlayerName>


<QuarterDay>

Morning is defined as:

Afternoon is defined as:

Evening is defined as:

Night is defined as:

<quarterday>


<Race>

Name from racialtypes.2da
<race>

Name from racialtypes.2da, but made lowercase
<Sir/Madam>


<sir/madam>


<Subrace>

Subrace field set by player or by script (GetSubRace/SetSubRace)
<bitch/bastard>


Custom Tokens

See the nwnlexicon tutorial on custom tokens for more information.

Colour Custom Tokens

A subset of custom tokens - you can use <cRGB></c> where RGB is a RGB code but, of course since this isn't simple, it's not in number form but ASCII character reference...very odd (smile)

This means you can use a long ASCII string to find the right "number", eg;

Code Block
const string COLOR_TOKEN = "                  ##################$%&'()*+,-./0123456789:;;==?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[]^_`abcdefghijklmnopqrstuvwxyz{|}~~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ¡¡¢£¤¥¦§¨©ª«¬¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþþ";

string GetStringColoredRGB(string sString, int nRed=255, int nGreen=255, int nBlue=255)
{
    return "<c" + GetSubString(COLOR_TOKEN, nRed, 1) + GetSubString(COLOR_TOKEN, nGreen, 1) + GetSubString(COLOR_TOKEN, nBlue, 1) + ">" + sString + "</c>";
}

This function can make a complete string that then could be passed, say, to a custom token for inclusion in a conversation. It can also be used in other text locations (eg; SpeakString, SendMessageToPC, etc.)

A simpler version is available in x0_i0_string.nss

The game uses the <cRGB></c> format internally so it can be used by modders to create any coloured text.

If you want to add these tokens directly into a TLK file you can use webpages such as this: https://colortoken.nwn1.net/

For more information on colour tokens in general see: https://neverwintervault.org/project/nwn1/other/hitchhikers-guide-color-tokens

You can find a more advanced set of scripts for color tokens here: https://github.com/silm/silm/blob/master/mod/nss/includes/inc_colors.n

...

Colour Tokens

...

To have a <cXXX> code in a conversation/journal/description you can't input it directly. Instead you need to wrap it in a <CUSTOMXXX> token. To do this have a script like this in the OnModuleLoad:

Code Block
const string COLOR_TOKEN = "                  ##################$%&'()*+,-./0123456789:;;==?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[]^_`abcdefghijklmnopqrstuvwxyz{|}~~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ¡¡¢£¤¥¦§¨©ª«¬¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþþ";

string GetRGBCToken(int nRed=255, int nGreen=255, int nBlue=255)
{
    return "<c" + GetSubString(COLOR_TOKEN, nRed, 1) + GetSubString(COLOR_TOKEN, nGreen, 1) + GetSubString(COLOR_TOKEN, nBlue, 1) + ">";
}
 
void main()
{
    SetCustomToken(1000, "</c>");
    SetCustomToken(1001, GetRGBCToken(255, 0, 0));
    SetCustomToken(1002, GetRGBCToken(0, 255, 0));
    SetCustomToken(1003, GetRGBCToken(0, 0, 255));
}

Then in the conversation editor you can do this:

...

.

...

Alternatively setting a handful manually may be more reliable:

Code Block
// OnModuleLoad
void main()
{
    SetCustomToken(1000, "</c>"); // CLOSE tag
    SetCustomToken(1001, "<cþ  >"); // red
    SetCustomToken(1002, "<c þ >"); // green
    SetCustomToken(1003, "<c  þ>"); // blue
    SetCustomToken(1004, "<c þþ>"); // cyan
    SetCustomToken(1005, "<cþ þ>"); // magenta
    SetCustomToken(1006, "<cþþ >"); // yellow
    SetCustomToken(1007, "<c   >"); // black
    SetCustomToken(1008, "<c¥  >"); // dark red
    SetCustomToken(1009, "<c ¥ >"); // dark green
    SetCustomToken(1010, "<c  ¥>"); // dark blue
    SetCustomToken(1011, "<c ¥¥>"); // dark cyan
    SetCustomToken(1012, "<c¥ ¥>"); // dark magenta
    SetCustomToken(1013, "<c¥¥ >"); // dark yellow
    SetCustomToken(1014, "<c¥¥¥>"); // grey
    SetCustomToken(1017, "<cŒŒŒ>"); // dark grey
    SetCustomToken(1015, "<cþ¥ >"); // orange
    SetCustomToken(1016, "<cþŒ >"); // dark orange
    SetCustomToken(1017, "<cÚ¥#>"); // brown
    SetCustomToken(1018, "<c† >"); // dark brown
}

Ordering Lists

Anything that orders on the contents of a string - eg the feats or skills in a character sheet - can be made into a custom order using empty colour strings, eg:

Code Block
<c0000></c>Feat Section 1
<c0001></c>Feat 1
<c0001></c>Feat 4
<c0001></c>Feat 6
<c0002></c>Feat Section 2
<c0003></c>Feat 2
<c0003></c>Feat 3
<c0003></c>Feat 5

Without the colour codes you will get the order "Feat 1, 2, 3, 4, 5, 6 Section 1, Section 2" but with them you get "Feat Section 1, 1, 4, 6, Section 2, 2, 3, 5"

Conversation Scripts

Script basic information to follow.