Might wanna add no parse to that post - a lightbulb smilie is putting it off abit, I wouldn't know how to correct that
I was gonna say if you accidently put "i" instead of "I" as well, something to correct that -
This is a very useful script for me I might add lol
[update]
quote:
Originally posted by dylan!
code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
if (sMessage.charAt(0) != '/' && sMessage.substr(0, 4) != 'www.' && sMessage.substr(0, 7) != 'http://') {
}
return punctuate(sMessage);
}
function punctuate(s)
{
var sentences = s.split(" ");
for (var i = 0; i < sentences.length; i++)
{
if (sentences[i].charAt(0) == "/")
{
return sentences.join(" ");
}
else{
if (i == sentences.length - 1 && isin(sentences[i].charAt(sentences[i].length - 1), "abcdefghijklmnopqrstuvwxyz0123456789"))
{
sentences[i] = sentences[i] + ".";
}
if (i == 0)
{
sentences[i] = sentences[i].charAt(0).toUpperCase() + sentences[i].substr(1);
}
else
{
if (isin(sentences[i-1].charAt(sentences[i-1].length - 1), ".?!"))
{
sentences[i] = sentences[i].charAt(0).toUpperCase() + sentences[i].substr(1);
}
}
}
}
return sentences.join(" ");
}
function isin(needle, haystack)
{
for (var i = 0; i < haystack.length; i++)
if (haystack.charAt(i) == needle)
return true;
return false;
I think someone should make it so it adds " ' " 's into the right spots or I could just replace all the theyre with they're and so on
Keep getting an error saying that scripts defective Dylan!
I've manged to work it out for now with the other codes - with a little help from a friend.