Neverwinter Vault

Expand AllContract All -Site -My Profile -Features

Neverwinter Nights 2

-NWN2 Files -NWN2 Game Info -NWN2 Resources -NWN2 Community

Neverwinter Nights

-NWN Files -NWN Game Info -NWN Resources -NWN Community

Vault Network
RPG Vault
VN Boards
IGN Vault
Vault Wiki
· Age of Conan
· Anarchy Online
· Asheron's Call
· Dark Age of Camelot
· City of Heroes
· D&D
· EVE Online
· EverQuest
· EverQuest 2
· Final Fantasy
· Guild Wars
· Lineage 2
· Lord of the Rings Online
· Middle Earth
· Neverwinter Nights
· Pirates of the Burning Sea
· Rise of the Argonauts
· Star Wars Galaxies
· Tabula Rasa
· The Matrix Online
· The Witcher
· Titan Quest
· Two Worlds
· Vanguard
· Warhammer
· World of Warcraft

Planet Network
Planet Hub

IGN
Games
Cheats
Entertainment

The Web   The Site  



NWN2 SCRIPTS

- Jump to comments -
Name  SendText with ColorText Support
Author  demetrious
Submitted / Updated  11-01-2006 / 11-22-2006
Category  Scripting routines
Type  Type - Other
Format  Code Only
Patch  1.00
Description
Updated to Version 1a1

This is a relatively simple include file that aims to improve basic message sending with NWN2. It includes 5 basic functions for sending text to players with color text support.

Why use this?

SendMessageToPC() and FloatingTextString() do not support coloring text inherently. Second, the format between the two is not consistent. Third, they are long functions to type. Finally, party messaging / DM messaging / Variable based messaging are not strongly supported without writing the code yourself. This include file addresses each of these issues. I wrote it for myself for DMFI development and have uploaded it here for public use.

It is a sub-component of the future DMFI Tools for NWN2. It is also a sub-component of the Custom Token Dialog System.

Documentation is included. If there are errors, please post and they will be corrected.

Included functions:

SentText(): Player / faction color messaging.

SendTalkText(): Forced speak color messaging.

SendDMText(): DM oriented color messaging.

SendPartyText(): Party based color messaging.

SendPCText(): PC Integer state based color messaging.

ColorText(): Add color text support.


Revision Log:

1a1: Only function changed was ColorText(). Fixed a few colors that were not working and spent an hour tweaking the various colors so that they were more varied.

Files

NameTypeSizeDownloads
SendText_with_ColorText_v1a1.zipSendText_with_ColorText_v1a1.zip
Submitted: 11-01-2006 / Last Updated: 11-17-2006
zip66.54Kb433
Updated to version 1a1 to fix / improve the ColorText function.
SCORE OUT OF 10
10
2 votes
View Stats
Cast Your Vote!
Voting FAQ

PORTFOLIO
Add this entry to your portfolio so you can track it
Manage your existing portfolios or create a new one.
SCREENS





You Must Be Logged In to Participate.
Comments (16):

Posted by demetrious at 2007-01-29 12:58:18    
The point is, as stated, a simple wrapper that makes doing a few things simplier - at least IMO. It doesn't attempt or pretend to do anything revolutionary.

It was released day 1 and offers a nice easy method to send text messages in color without knowledge of hex values and other things that non-programmers may not be familiar with as well as several other features listed above.

But if it doesn't suit your needs, that is fine - hopefully it helps some people. Thanks for stopping by.

Posted by Saulus at 2007-01-29 10:30:21    
Okay I did the same mistake as 0100010. Screw it.
_________________________
Sundren, A Neverwinter Nights 2 Persistent World in the Forgotten Realms setting.

Link

Posted by Saulus at 2007-01-29 10:29:34    
Sorry, it seems the vault comment system parsed out my code... After doing the " but before the 'text here' I put "" and at the end I did "" (without the quotes). There are several other html-style functions like this in NWN2, like changing the font. Though I don't think the font changing works.
_________________________
Sundren, A Neverwinter Nights 2 Persistent World in the Forgotten Realms setting.

Link

Posted by Saulus at 2007-01-29 10:26:57    
Not to be rude, but what is the point in this script?

You could just do SendMessageToPC(oPC, "Text here");

Of course you can substitute red for a HEX value as well. This works with floatingtextstring on creature and I think pretty much everywhere else in the engine as well.
_________________________
Sundren, A Neverwinter Nights 2 Persistent World in the Forgotten Realms setting.

Link

Posted by ThugNMe4Evea at 2006-12-05 18:14:17    
SendMessageToPC(oPC, "XXXX");
exactally what i wanted to know, thx and thax for your help on my scripting topic also.

Posted by demetrious at 2006-12-05 05:51:07    
I not certain I understand.

For many functions, like SendText, you can specify whether the text is floating or not. If the text is floating, it uses FloatingTextStringOnCreature to send the message and if not, it uses SendMessageToPC. If I understand correctly:

SendText(oPC, "Text", FALSE, COLOR_RED);

Sends a red text message to the chat window only via SendMessageToPC().

Posted by ThugNMe4Evea at 2006-12-04 16:35:12    
does this also send to chat window?

Posted by Ryam_BaCo at 2006-11-27 14:17:54    Voted 10.00 on 11/27/06
short, neat and effective. thanks a lot! :)
_________________________
A Bet, A Corpse
A Corpse, A Vote

Being Good

Posted by demetrious at 2006-11-24 21:26:15    
I agree both work. For me, I'm staying put I think.

Here is why I went the way I did. I wanted early scripters to use colors and the COLOR constants are in the scripting language and I thought it would be confusing to actually NOT use them. Secondly, consistency in using different colors is a priority in my opinion so I thought people were better off to have 16 (or so) colors that were reasonably different yet consistent and readily at hand rather than remembering values or creating near duplicate constants. I thought that using 10 colors well was a higher priority than have infinite colors availables.

So yes that works, but this was a design decision that approaches coloring text from a little more simplistic, consistent, yet straightforward approach.

I appreciate the comments. If I'm missing something where you get the flexibility / ease of use of both - slap me. :)

Posted by 0100010 at 2006-11-24 21:18:32    
Ok it mangles it 3 times, I give up. how in the hell do you make your comments display a greater-than and a less-than symbol?

Posted by 0100010 at 2006-11-24 21:16:54    
And it mangled it twice...

In the below replace "lt;" with ""


Posted by 0100010 at 2006-11-24 21:15:25    


string ColorText(string sText, int nRed=255, int nGreen=255, int nBlue=255)
{
int nRGB = (nRed * 65536) + (nGreen * 256) + nBlue;
string sColorHex = GetSubString(IntToHexString(nRGB),2, 8);
return "<color=#" + sColorHex + ">" + sText + "lt;/color>";

}

Posted by 0100010 at 2006-11-24 21:09:29    
Ok the comments board mangled my code...

Posted by 0100010 at 2006-11-24 21:04:46    
You will find this a be a better color function.

//Adds a color token to sText from the given RGB values
string ColorText(string sText, int nRed=255, int nGreen=255, int nBlue=255)
{
int nRGB = (nRed * 65536) + (nGreen * 256) + nBlue;
string sColorHex = GetSubString(IntToHexString(nRGB),2, 8);
return "" + sText + "";

}

This gives you the full range of RGB colors instead of being limited to the pre-selected ones.

Posted by camelbox at 2006-11-18 10:00:42    Voted 10.00 on 11/18/06
Usefull, thanks :)

Posted by demetrious at 2006-11-17 06:17:22    
Version 1a1 Update:

I hate having the need for the revision, but in fact, it is needed. A 2 of 17 colors would not display properly. I also spent time tweaking several colors to make them more varied within a conversation.

You must be Logged In to post comments in this section.

10 - A Masterpiece, Genuinely Groundbreaking
9 - Outstanding, a Must Have
8 - Excellent, Recommended to Anyone
7 - Very Good, Deserves a Look
6 - Good, Qualified Recommendation
5 - Fair, Solid yet Unremarkable
4 - Some Merit, Requires Improvements
3 - Poor Execution, Potential Unrealized
2 - Very Little Appeal
1 - Not Recommended to Anyone

 
Most recent posts on the MMO General Boards
Analyst: Star Wars: The Old Republic Could...Analyst: Star Wars: The Old Republic Could Sell 3M: more numbers
- last reply by Acao on Aug 15, 2011 06:15 PM
which class will your first character be
- last reply by Blisteringballs on Aug 15, 2011 05:50 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 05:00 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 04:00 PM
NWN Idea Database Update
- posted by Vault_News on Aug 15, 2011 03:46 PM
Missing Votes for NWN2 Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:40 PM
Missing Votes for NWN Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:39 PM
Random Questions and game altering suggest...Random Questions and game altering suggestions!!!
- last reply by ArkadyTepes on Aug 15, 2011 03:22 PM
State of the game?
- last reply by LyricOpera on Aug 15, 2011 01:37 PM
Yesterday streaming, now demanding downloa...Yesterday streaming, now demanding download :(
- last reply by Sinane-tk on Aug 15, 2011 10:23 AM
 

   


IGN Entertainment
By continuing past this page, and by your continued use of this site, you agree to be bound by and abide by the User Agreement.
Copyright 1996-2011, IGN Entertainment, Inc. | Support | Privacy Policy | User Agreement | RSS Feeds
IGN’s enterprise databases running Oracle, SQL and MySQL are professionally monitored and managed by Pythian Remote DBA.


NWN2 Hall of Fame

HOF NWN2 Scripts


View all Hall of Fame entries


Neverwinter Nights 2

TOP NWN2 Modules

NEW Modules

NEW Reviews

NEW INTL. Modules

TOP Hakpaks

TOP Gameworlds

TOP Tutorials

TOP Prefab:Areas

TOP Blueprints

TOP Plugins

TOP UI

TOP Other

TOP Visual Effects

TOP Scripts

TOP Tools

TOP Movies

TOP Models

TOP Characters





Hall of Fame

HOF NWN Modules


View all Hall of Fame entries


TOP NWN Modules

NEW NWN Modules

NEW Reviews

TOP Intl. Modules

TOP NWN Hakpaks

TOP NWN Gameworlds

TOP NWN Models

TOP NWN Portraits

TOP NWN Scripts

TOP NWN Prefabs

TOP NWN Other

TOP NWN Movies

TOP Sounds

TOP NWN Textures

TOP NWN Creatures

TOP NWN Characters