This project enables 146 color names to be used as color-changing tokens in dialogue, object names and descriptions and PC chat messages. Instead of using hard-to-remember <CUSTOMxxxx> tokens or hard-to-type NWN ASCII tokens (such as <c~!!>), you can now use simple named color tokens like this: <ncOrange>this text is now orange</nc>. This project also provides a library for color token generation from RGB and HSV color structs.
A demo module is provided.
DESCRIPTION
Names of colors available through this project come from SVG color list. There is a total of 147 of them, but one had to be removed since it had too long name (NWN limits token length to 16 characters). That was color named LightGoldenrodYellow. There are similar colors, so no big deal.
All named color tokens start with "nc" characters and use CamelCase, for example <ncYellowGreen>
. To reset text color to default white, use </nc>
token. A complete list of them may be found in HTML file next to this readme. This is more than most (if not all) modules will ever need.
Because of 16 character limit, some color names had to be abbreviated in following fashion:
<ncLGreen></nc>
for LightGreen.<ncMOrchid></nc>
for MediumOrchid.<ncDGoldenrod></nc>
for DarkGoldenrod.This project also modifies the <StartHiglight> default toolset token by changing its resulting color from badly visible blue to the same green as <StartAction>. This change is done via stringtokens.2da override.
Named color tokens work with dialogue instantly - no scripting is needed at all. However in order to apply them to object names and descriptions, you have to use a script. One is provided in the erf file: ncts_apply. Make any object execute it and its name and description will be updated.
If you want to use named color tokens in scripts, refer to ncts_include script in the erf file and to API presented below (see builder notes).
Since version 1.2 it is possible to generate every possible ASCII color token with scripts using RGB or HSV color components. Conversion between these two color spaces is also possible with provided functions.
Since version 2.0 it is possible to colorize PC chat messages. This is done with single OnPlayerChat event handler script. Just add tokens to the text like you would type a conversation - they will be applied when the message is send. Module builders need to enable this functionality. One such chat-handling script is provided in the erf file: ncts_chat.
CHANGELOG
2.0 (2019-01-15)
1.3 (2018-10-27)
1.2 (2018-10-09)
1.1 (2018-09-30)
1.0 (2018-09-28)
INSTALLATION
This project can be installed in two different ways, depending on what kind of functionality is required. Both are possible at the same time.
Attention: if you choose option 1 above, stringtokens.2da placed in the override folder will affect your whole installation of NWN. This should have no negative impact on other modules, but may also cause problems with non-english versions of the game.
Attachment | Size |
---|---|
![]() | 26.76 KB |
![]() | 12.5 KB |
This project should be really in "speedrun" category - less than 24h since initial concept to release.
Can anyone confirm that stringtokens.2da is actually not picked up from hak files by the game?
Also don't miss my other recently-updated projects:
EDIT: looks like when stringtokens.2da is not in override but in hak, it is accessible from script level (meaning changing object names and descriptions work) but not in dialogue.
Did you try Get2DAString(string, string, int) (online lexicon page)? For dialogues did you try the other actions section?
TR
I do use this function. In fact - extensively - I loop over 2das here. What do you mean by "other actions"?
I have an update almost ready - will post it tomorrow. It concerns mostly scripting.
On the bottom right of the conversation editor there are a number of tabs. The first one is "Text Appears When...". The next is "Actions Taken" and the one after that is "Other Actions". Unfortunately, having done some more thought, I don't think it will work even if I had told you the right tab anyway (should have said actions taken). Sorry about that.
TR
OK, I understand what you mean. Unfortunately "other actions" doesn't contain any useful elements for color changing. I didn't want to use the two usual tabs since the whole point of this project was to avoid using scripts and CUSTOMxxxx tags to color the dialogue. You type <ncGold>this is gold</nc> and that's it. Can't get any simpler and faster. Did you try the demo?
Not yet. Too busy looking at your colour chart and getting on with RL I'm afraid. I applaud the simplicity though.
TR
I suggest you wait for the update then. It's impressive how much beyond what's written in the "The Hitchhiker's Guide" one can push this engine.
Will do. Having seen and walked around one of these (Art as opposed to game models i.e. mdl file is BIG) in game (It was an experiment by OTR) Nothing surprises me any more.
TR
There you go - ready for download. Layout of that site gives me the "Web 1.0" nostalgic feeling.
Now tried it and have a problem. I've sent you a pm on the forums. Used the forums because posting a picture is so easy there. I see that you haven't been on them yet. Just click on forums at the top of this page and then click on Log In. Because you already have an account on here it will log you in automatically.
TR
I know how to use the forum but I don't use it often as it is quite a resource hog. Anyway I'll reply here so it will benefit all users.
Here's an excerpt from project's readme (emphasis mine):
In the demo, just talk to The Parrot and ask it to show you how named colors can be used in object names and descriptions (reply #3).
this is cool.
Updated to 1.1. Found and fixed a really obvious bug with female PCs.
I also modified PC description changing in the demo module so you can party hard with it.
Updated to 1.2. This is a verbatim copy of the changelog from project's description:
I also updated the demo module: three new scripting demos are available (see the screenshots).
There is a problem with using this in conjunction with the Shadow Guard premium module. See my post in the forums.
TR
There was a bug in stringtokens.2da involving StartAction, StartCheck and StartHighlight tokens. Fixed in version 1.3 released today. Thanks for reporting it.
NCTS has been updated to version 2.0: enjoy the most advanced (and documented) text color management project on the vault.
Major version number increase since changes introduced today make it incompatible with 1.x branch. There are several improvements - most important ones are listed below:
Please report any bugs you encounter, but be sure to talk first to The Parrot in the demo module.