Client side script
This script will allow you do do several things in any server, all you have to do is put it in your autoexec folder.
>Highlight certain words or peoples text
>Bind chat commands and text to a key ingame
>Ignore anyone you choose completely
>Use simple ROT encryption
I'll add to it when ever i think of something else to add
the chat commands binding is to die for tho.
>Highlight certain words or peoples text
>Bind chat commands and text to a key ingame
>Ignore anyone you choose completely
>Use simple ROT encryption
I'll add to it when ever i think of something else to add

Comments
package CustomChat{ function clientCmdChatMessage(%sender, %voice, %pitch,%msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10){ %NewMsg = TextCatchIncoming(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10); if(%NewMsg !$= "" || %a1 $= "") Parent::clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %NewMsg, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10); }In that part of the code where is the actual message the player sends? is it %msgString or one of the %a1 - %a10?and how can i use a chat command to work with my script? say i have a fucntion die(){ in my own script how can i call that fucntion through the chat hud?
$Rot::ActivationKey = "%"; function Rot_encodeMessage(%message) { %encode = getsubstr(strlwr(getword(%message, 0)), 0,1); %message = strlwr(getwords(%message, 1)); %len = strlen(%message); %rot = strcmp(getsubstr(%encode, 0,1), "a")+1; %encode = "~ "@ %encode @" "; for(%i = 0; %i < %len; %i++) { %char = getsubstr(%message, %i,1); %cmp = strcmp(%char, "a"); if(%rot != 0 && %cmp >= 0 && %cmp < 26) %char = rotChar(%char, %rot); %encode = %encode @ %char; } return %encode; } function Rot_decodeMessage(%message) { %encode = strlwr(getword(%message, 1)); %message = strlwr(getwords(%message, 2)); %len = strlen(%message); %rot = strcmp(getsubstr(%encode, 0,1), "a")+1; for(%i = 0; %i < %len; %i++) { %char = getsubstr(%message, %i,1); %cmp = strcmp(%char, "a"); if(%rot != 0 && %cmp >= 0 && %cmp < 26) %char = rotChar(%char, -%rot); %decode = %decode @ %char; } return %decode; } function rotChar(%char, %dist) { %cmp = strcmp(%char, "") + %dist; if(%cmp > 122) %cmp -= 26; if(%cmp < 97) %cmp += 26; return collapseEscape("\\x" @ decToHex(%cmp)); }And, all these "here's my super-awesome script" posts are making me contemplate releasing some of mine. . .
package CustomChat{ function clientCmdChatMessage(%sender, %voice, %pitch,%msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10){ %NewMsg = TextCatchIncoming(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10); if(%NewMsg !$= "" || %a1 $= "") Parent::clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %NewMsg, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10); }In that part of the code where is the actual message the player sends? is it %msgString or one of the %a1 - %a10?and how can i use a chat command to work with my script? say i have a fucntion die(){ in my own script how can i call that function through the chat hud?
//Phantom $RemapName[$RemapCount] = "Encode Chat"; $RemapCmd[$RemapCount] = "ToggleEncoderHud"; $RemapCount++; //Dark Dragon DX $RemapName[$RemapCount] = "Unicode Chat"; $RemapCmd[$RemapCount] = "ToggleUnicoderHud"; $RemapCount++; //Phantom's Fixes(modifications) function ToggleMessageHud(%make) { if(%make) { MessageHud.isTeamMsg = false; MessageHud.isencoded = false; MessageHud.isunicoded = false; MessageHud.toggleState(); } } function TeamMessageHud(%make) { if(%make) { MessageHud.isTeamMsg = true; MessageHud.isencoded = false; MessageHud.isunicoded = false; MessageHud.toggleState(); } } function ToggleEncoderHud(%make) { if(%make) { MessageHud.isencoded = true; MessageHud.isunicoded = false; MessageHud.isTeamMsg = false; MessageHud.toggleState(); } } function ToggleUnicoderHud(%make) { if(%make) { MessageHud.isunicoded = true; MessageHud.isencoded = false; MessageHud.isTeamMsg = false; MessageHud.toggleState(); } } //Other function MessageHud_Edit::eval(%this) { %text = trim(%this.getValue()); if(%text !$= "") { if(MessageHud.isTeamMsg) commandToServer('teamMessageSent', %text); else if(MessageHud.isencoded){ encode(%text); } else if(MessageHud.isunicoded){ %EN = Unicode_Encrypt(%text); commandtoserver('messagesent',"\c5DUD:\c4" SPC %EN); } else{ commandToServer('messageSent', %text); } MessageHud.close(); } } function MessageHud::open(%this) { %offset = 6; if(%this.isVisible()) return; if(%this.isTeamMsg) %text = "TEAM:"; else if(%this.isencoded) %text = "ENCODE:"; else if(%this.isunicoded) %text = "DUD:"; else %text = "GLOBAL:"; MessageHud_Text.setValue(%text); %windowPos = "8 " @ ( getWord( outerChatHud.position, 1 ) + getWord( outerChatHud.extent, 1 ) + 1 ); %windowExt = getWord( OuterChatHud.extent, 0 ) @ " " @ getWord( MessageHud_Frame.extent, 1 ); if( MainVoteHud.isVisible() ) { %votePos = firstWord( MainVoteHud.position ) @ " " @ ( getWord( OuterChatHud.extent, 1 ) + getWord( messageHud_Frame.extent, 1 ) + 10 ); MainVoteHud.position = %votePos; } if( voiceCommHud.isVisible() ) { %vCommPos = firstWord( voiceCommHud.position ) SPC ( getWord( OuterChatHud.extent, 1 ) + getWord( messageHud_Frame.extent, 1 ) + 18 ); voiceCommHud.position = %vCommPos; } %textExtent = getWord(MessageHud_Text.extent, 0); %ctrlExtent = getWord(MessageHud_Frame.extent, 0); Canvas.pushDialog(%this); messageHud_Frame.position = %windowPos; messageHud_Frame.extent = %windowExt; MessageHud_Edit.position = setWord(MessageHud_Edit.position, 0, %textExtent + %offset); MessageHud_Edit.extent = setWord(MessageHud_Edit.extent, 0, %ctrlExtent - %textExtent - (2 * %offset)); %this.setVisible(true); deactivateKeyboard(); MessageHud_Edit.makeFirstResponder(true); }function clientCmdChatMessage(%sender, %voice, %pitch,%msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10){can someone explain whats in each of those %a#?
%a2 = message
the others aren't really important
but if %a2 is the message... what is %msgString?
and if %a1 is the sender.... why is there a %sender?
%a1 is the name of the sender.
%sender is the client ID.
I don't really know what %msgstring is for. I think it's generated when you call addtaggedstring(%a2);
$Chat::WordSearch = "BlitzTorque"; function TextCatchIncoming(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10){ %origin = getWords(%a1, 1, getWordCount(%a1)); %id = plnametocid(%origin); if (%a1 $= "") return ""; %msgCount = getwordcount(%a2); for(%i=0;%i<%msgCount;%i++){ %listcount = getwordcount($Chat::WordSearch); for(%iB=0;%iB<%listcount;%iB++){ %MsgWord = strlwr(getWord(%a2,%i)); %ListWord = strlwr(getWord($Chat::WordSearch,%iB)); trim(%MsgWord); trim(%ListWord); if(strstr(%ListWord,%MsgWord) != -1 && strLen(%MsgWord) >= $Chat::MinWordLenght){ // if (%i > 0) // %first = getWords(%a2,0,%i-1); // if (%i < %msgcount) // %last = getWords(%a2,%i+1,getWordCount(%a2)); } } }Ok.... i have no idea what im doing... How do i search in a message to see if there is a certain word in that message?
if ( strstr( strlwr(%a2),"blitz") != -1 )
Of course, if you wanted to find a specific word and highlight it, you could do something like:
for (%i=0;%i<%msgCount;%i++) if ( stricmp( getWord( %a2,%i ), "BlitzTorque" ) == 0 ) %a2 = setWord(%a2,%i,"\c5" @ getWord(%a2,%i) @ "\c4");strstr(%a2, "BlitzTorque");
That would check the whole message to see if the word "blitztorque is in it? And if i use $WordSearch instead of blitztorque and set
$WordSearch = "BlitzTorque", "Blitz";
Would it search for both names?
Nope. If the words in $WordSearch are seperated by a space, you could use a for loop such as the one in the previous post, where the word count of $WordSearch would replace %msgCount, and you use strstr to search for getWord($WordSearch,%i).
%Message = strlwr(%a2); if($Chat::AFK == 1){ if(strstr(%Message, "blitztorque") != 1 || strstr(%Message, "blitz") != 1){ Do stuff here if "blitz" or "blitztorque" is in the message..... } }is that the correct way to use it?
and it would work for blitz even if the whole word is blitztorque?
I believe it would.
%Message = strlwr(%a2); if($Chat::AFK == 1){ if(strstr(%Message, "blitz") != -1){ commandtoserver('messagesent', "Test..."); } }i placed this code inside Mazo's Client script inside the functionfunction TextCatchIncoming(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10){But when someone says blitz nothing happens, but when i do a voice command it sends the message "test..."function clientCmdChatMessage(%sender, %voice, %pitch,%msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10){i also placed it in this code and the same thing happenedExperiment, experiment, experiment! Waiting around for somebody else to figure out what's been done wrong doesn't help. The code works, find out what's gone wrong. Use echo to find out the values of your variables, see what each is checking.
If it's going through only when you send a message, doesn't that sound like it's checking names?
If you're running Mazo's script you'll have to open it up and change or remove the movemap.bind lines. If you don't use the script, you can just change the key in your settings.
package custombinds{ function OptionsDlg::onWake(%this) { if (!$CBinds) { $RemapName[$RemapCount] = "Name"; $RemapCmd[$RemapCount] = "Function"; $RemapCount++; $RemapName[$RemapCount] = Name"; $RemapCmd[$RemapCount] = "Function"; $RemapCount++; $CBinds = true; } parent::onwake(%this); } }; activatepackage(custombinds);That's how I'd do it.