Author Topic: Client_Punctuation Help  (Read 1718 times)

I got a mod where it would automatically punctuate your sentence when you type, but it's not working. Please help?

The 'client.cs' without any ''s
Code: [Select]
//=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
//Title: Punctuation
//Author: Secton
//Description: Punctuates for you.
//Summery: Adds some Punctuation for you.
//Licence: Free
//=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=


package Punctuation
{
    function GlobleChat(%clanPre, %name, %clanSuf, %Msg)
    {    //run it though the filter
        strreplace(%Msg,nt,"n't");
        //This replaces "nt" with "n't"
        %LwrI = getWord(%Msg, i );
        //find a lowercase I...
        %UprI = strUpr(%Ilwr);
        //Turn it upercase
        strreplace(%Msg,%LwrI,%UprI);
        //Apply it to %msg
        strreplace(%Msg,youre,"you're");
        //make sure you're has "u're" in it   
        strreplace(%Msg,Im,"I'm");
        //its I am, not Im.
        parent::GlobleChat(%Msg);
        //Do all the other stuff you do.
    }
};
ActivatePackage(Punctuation);

And the description.txt

Code: [Select]
Title: Punctuation
Author: Secton
Automatic Punctuation for you

I stopped as soon as I saw "globle"

I stopped as soon as I saw "globle"
I didn't look through this that much T_T.
Is it supposed to be 'GlobalChat', and is that a pre-existing function?
« Last Edit: May 11, 2012, 08:42:17 PM by PurpleMetro »

A few problems:

strReplace returns a value, it doesn't do any magic to set it.
You'd have to set a variable to what it returns.

getWord's arguments are %string and %index, it returns the %indexth/st/rd word in the string. If you want to find if there's word, you have to make a function to do it (because there's not a default one in torque for some reason)

Here's one I made which seems to work:
Code: [Select]
function findWord(%sourceString, %searchWord)
{
for(%i = 0; %i < getWordCount(%sourceString); %i++)
{
if(getWord(%sourceString, %i) $= firstWord(%searchWord))
return %i;
}
return -1;
}


Your usage of strUpr sorta makes sense, but you have to have a way to put the uppercase I back into the string.


and when you're calling the parent, it's a good idea to include all the arguments.

"Hey, how do I ren't a boat?"

Hahaha no.

"Hey, how do I ren't a boat?"

Hahaha no.
Oh yeah, I forgot to say your way of doing this is kinda simplistic for such a thing.

You'll have to scratch your head for a bit if you want to figure out an accurate way to do this.

One second...

-snip-

I dien't even think such fundamental errors in code were possible. My brain must have just skipped over them because it refused to believe that was possible. Who SCRIPTED this pile of scrap?

Who SCRIPTED this pile of scrap?
some turtle named secton

Oh, hey, Ji'm, what'sup?

I don't know much about scripting but can somebody give me a finished copy. My friend gave me this script so I didn't make it. I just changed description and stuff to my name. But please somebody give me a error-free copy of this?

I don't know much about scripting but can somebody give me a finished copy. My friend gave me this script so I didn't make it. I just changed description and stuff to my name. But please somebody give me a error-free copy of this?
It's difficult when the entire basis of the code functionality is an error...

It's difficult when the entire basis of the code functionality is an error...
T_T.
Is it really that bad? If it is then my friend sucks at scripting T_T


What you are asking for is a fundamentally complicated thing. The English language is too complex for this sort of thing to be implemented easily by one person and this is too limited-use for a team of Blockland scripters to focus on. In other words, it might happen eventually, but it's unlikely.

What you are asking for is a fundamentally complicated thing. The English language is too complex for this sort of thing to be implemented easily by one person and this is too limited-use for a team of Blockland scripters to focus on. In other words, it might happen eventually, but it's unlikely.
Alright.. I understand.. I just thought that.. this was a cool thing to have.