Aller au contenu

Photo

Help, script speed color


  • Veuillez vous connecter pour répondre
21 réponses à ce sujet

#1
voignar

voignar
  • Members
  • 10 messages
Anyone can help me? I am looking for a script for when you enter the chat between ** or in () to change the text color inside. It is said, the script in most role-playing servers.

And if anyone can also a script for when a new player enters or if anything has changed in your account for a password. If the password is invalid, you leave the game.

thanks

#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
bump.

#3
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 878 messages
Securing Your Server Without Master Server Authentication - Very handy scripts provided by FunkySwerve

For colored chat text, I personally use an include file to add a ColorText() function in my module's OnPlayerChat script. I have the chat script look for specific characters at the start of the entered text (// double slashes for grey "OOC" text, .. double periods for "emotes"), then colorize the rest of the text string before replacing the output text (SetChatMessage()?).

I'll see about digging into my chat script to try to dig up the specific code for the text coloring. It's embedded somewhere in the middle of about 1000 lines of code.

Not sure on the original source of the include file...probably a generous poster on the old BioWare boards. I've been using it for years.

Edit: Forum seem to be able to properly handle the code for the include file. Link: inc_colortext.nss (right-click and "Save Link As..." to download.


color chat sample
// Colorized Onchat text
// merge into your own onplayerchat script

#include "inc_colortext"
void main()
{
string sInput = GetPCChatMessage();
string sFirst = GetStringLeft(sInput, 1);
string sLast = GetStringRight(sInput, 1);
if (sFirst == "*" && sLast == "*")  // Special Text Type 1
   {
   sInput = ColorText(sInput, 255, 0, 255);
   SetPCChatMessage(sInput);
   }
else if (sFirst == "(" && sLast == ")")  // Special Text Type 2
   {
   sInput = ColorText(sInput, 200, 200, 200);
   SetPCChatMessage(sInput);
   }
}

Modifié par The Amethyst Dragon, 08 novembre 2011 - 07:50 .


#4
voignar

voignar
  • Members
  • 10 messages
Thanks but the color code gives a compilation error in line:
string sInput = GetPCChatMessage();

#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Are you running nwn with both expansion packs installed?  
if you are not.  and are not updated to 1.69  I do not think there is any way for you to change the color of the PC's chat.  
GetPCChatMessage was added in the 1.69 update.    So you will at least need to run the critical rebuild if you are not at verson 1.69


http://www.neverwint...characterbasics

#6
voignar

voignar
  • Members
  • 10 messages
If I have installed the version 1.69

#7
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

voignar wrote...

If I have installed the version 1.69


if you have 1.69 installed,  I do not know, it compiled fine for me. 

What error message are you getting?

#8
voignar

voignar
  • Members
  • 10 messages
This is the error:

http://img811.images...sinttulolrv.png

#9
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 878 messages
Line 17: You have it trying to set a variable called "sInput0058", but you've never set up that string variable. It should actually be "sInput".

If you're still having problems, then I think the problem might be with your game version/patch level. Which version or patch level is yours?

#10
voignar

voignar
  • Members
  • 10 messages
The variable is solved. But the fault is still on line 7. My game version is 1.69.


Edit.:I reinstalled everything and updated to 1.69 and still does not compile, and of course, does not work.

Modifié par voignar, 13 novembre 2011 - 12:46 .


#11
henesua

henesua
  • Members
  • 3 867 messages
Did you compile the include?

There are two scripts here to incorporate into you mod. One is the include which is accessed at that link, and the rest is the code pasted in the forum. You need both. Compile the include first. Then compile the other script.

Modifié par henesua, 13 novembre 2011 - 02:53 .


#12
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

henesua wrote...

Did you compile the include?

There are two scripts here to incorporate into you mod. One is the include which is accessed at that link, and the rest is the code pasted in the forum. You need both. Compile the include first. Then compile the other script.


umm,  You do not compile Include scripts.   If a Include script does compile on its own, you have a problem.

#13
Xardex

Xardex
  • Members
  • 217 messages
Dragons script only works if the message starts and ends with either ** or ().

This works even if there is "normal" text in the message.
e.g. You could say: I wonder why... *scratches head*

void main()
{
    // Variables
    object oPC = GetPCChatSpeaker();
    string sText = GetPCChatMessage();
    string sFinal = "";
    int iAmRockstar = TRUE;

    // Find color initiation
                   int iStart = FindSubString(sText, "*", 0);
    if (iStart == -1) {iStart = FindSubString(sText, "(", 0); iAmRockstar = FALSE;}
    if (iStart == -1) return;                                           // :C

    // Find color termination
    int iEnd;
    if (iAmRockstar) iEnd = FindSubString(sText, "*", iStart+1);
    else             iEnd = FindSubString(sText, ")", iStart+1);

    // Reconstruct message
    sFinal += GetSubString(sText, 0, iStart) + "<cÞ·/>";
    if (iEnd>-1) sFinal += GetSubString(sText, iStart, iEnd+1 - iStart) + "</c>";
    else iEnd = iStart -1;
    sFinal += GetSubString(sText, iEnd+1, GetStringLength(sText) - iEnd+1);

    // Send message
    SetPCChatMessage(sFinal);
}


It only allows one either ** or (), not both or more then one. Also allows one to type like this
I wonder why... (scratches head
Everything is colored after ( or *, until you get to ) or *, respectively.

Should work as it is if you put it to OnChat event of your module.

Modifié par Xardex, 13 novembre 2011 - 04:03 .


#14
voignar

voignar
  • Members
  • 10 messages
http://img23.imagesh.../sinttulobe.png

Error...

#15
Fester Pot

Fester Pot
  • Members
  • 1 394 messages
If this is the error, you are not updated to the latest patch and it's made perfectly clear by the functions available to you in the screen you provided that you clearly are not, otherwise all these functions would be available to you in your functions filter:

Your screenshot of your own functions filter for GetPC has the following first three missing:

GetPCChatMessage (1.69 addition)
GetPCChatSpeaker (1.69 addition)
GetPCChatVolume (1.69 addition)

(what your function list has)
GetPCIPAddress
GetPCItemLastEquipped
GetPCItemLastEquippedBy
GetPCItemLastUnequipped
GetPCItemLastUnequippedBy
GetPCLevelingUp
GetPCPlayerName
GetPCPublicCDKey
GetPCSpeaker

From the 1.69 release notes:

Script-specific:
· Added new scripting commands:
object GetPCChatSpeaker();
string GetPCChatMessage();
int GetPCChatVolume();
void SetPCChatMessage(string sNewChatMessage="");
void SetPCChatVolume(int nTalkVolume=TALKVOLUME_TALK);


FP!

Modifié par Fester Pot, 13 novembre 2011 - 06:49 .


#16
voignar

voignar
  • Members
  • 10 messages
Well, I'm sorry, really, thank you all, does not work and guarantee 100% that I upgraded to version 1.69. Can someone provide me a link to the patch to re-install or dawn to overwrite it?

#17
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Lightfoot8 wrote...

Are you running nwn with both expansion packs installed?  
if you are not.  and are not updated to 1.69  I do not think there is any way for you to change the color of the PC's chat.  
GetPCChatMessage was added in the 1.69 update.    So you will at least need to run the critical rebuild if you are not at verson 1.69


http://www.neverwint...characterbasics



here it is again.

EDI: The link just come in a little low on the page. scroll up a little.

Modifié par Lightfoot8, 13 novembre 2011 - 07:04 .


#18
voignar

voignar
  • Members
  • 10 messages
I reinstalled the game again to version 1.69, and is exactly the same. Could someone upload your nwntoolset.exe to see if it works? thanks

#19
voignar

voignar
  • Members
  • 10 messages
I know what the problem. The module is made ​​with a previous version and has not been updated much they updated the game. Can I upgrade in some way a module of another version to 1.69?

#20
Fester Pot

Fester Pot
  • Members
  • 1 394 messages
Modules have no relation to the version of the game, they will open and be useable no matter the version they were made with and are updated to the new version when the module is saved. It's the game itself that adds the new changes and the updates, so if you still don't have these functions available, then your installation might have become corrupted - in which case a full manual uninstall would be required - or you have a version of Neverwinter Nights that is of another language - French, Polish, Italian, etc. - which Bioware never made a 1.69 patch for and 1.68 is as official as those languages get.

To check your toolset.exe version, load up the toolset.

Click the HELP dropdown.

Select ABOUT.

A version window will appear which will give you information on the toolset version as well as the update version.

Bioware Aurora Neverwinter Nights Toolset
Game Version: v1.69
NWToolset Version: vts030

Expansion Packs Installed:

Expansion Pack 1
Expansion Pack 2

It's worth noting that the proper 1.69 critical build file that Lightfoot linked to would need to be downloaded if by chance, you only have one or none of the expansion packs.

Also, pay attention to the patch window when the critical build file is run for any messages - such as errors - which may be preventing your version of Neverwinter Nights from being updated.

Another sure way to check the version of Neverwinter Nights is to cross reference the version number from the toolset, as mentioned above, to the version listed in the top left corner when you launch the game. They should match.

Third, you can open up your nwconfig.ini file, located in your Neverwinter Nights installation directory and the top two lines will give you the version update you're running as well.

[version]
Game=1.69

FP!

Modifié par Fester Pot, 13 novembre 2011 - 10:36 .


#21
voignar

voignar
  • Members
  • 10 messages
I have checked everything you said and I have beaten. I do not know if that you say is correct because I have many modules and get the getpcchatmessage some and not others ...

#22
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
See if you have a modified copy of nwscript in your module.

in the script editor.

select open new file and type nwscript in the "Resource Name" field
if it shows up with either the 'Module Resource Only' or Hak Pack Resource Only' radio buttons checked that that is your problem. The module builder was messing with something he should not have been and blocked the Patch from taking full effect.