Capital letter & a dot |
Author: |
Message: |
Mentality
Full Member
The Best Representation OF me IS ME!
Posts: 490 Reputation: 19
39 / /
Joined: Jun 2005
|
RE: Capital letter & a dot
Can someone post teh full script
I'm dyslexic and can edit it all in different parts because I don't understand.
sorreh
|
|
07-02-2006 09:03 PM |
|
|
dylan!
Senior Member
l33t p4int3r
Posts: 665 Reputation: 30
– / /
Joined: Jan 2005
|
RE: Capital letter & a dot
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
This post was edited on 07-02-2006 at 09:28 PM by dylan!.
|
|
07-02-2006 09:11 PM |
|
|
Mentality
Full Member
The Best Representation OF me IS ME!
Posts: 490 Reputation: 19
39 / /
Joined: Jun 2005
|
RE: Capital letter & a dot
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.
This post was edited on 07-02-2006 at 09:38 PM by Mentality.
|
|
07-02-2006 09:22 PM |
|
|
Tartooob
Junior Member
Posts: 44
Joined: Jul 2005
|
RE: RE: Capital letter & a dot
quote: Originally posted by Dark_Nightmare
Success! After much fiddling, i've done 75% of what you guys want/need.
Typing "/" will make the rest of the message untouched by the punctuation changes.
Automatically makes the letter after a space after a "!", "?" and "." a capital.
(ie woot. i rocks! yep!
becomes
Woot. I rocks! Yep!)
Automatically ends any open-ended sentences (ie, without any ending punctuation) with a full stop.
All that jazz...
Except, i cannot configure it so that it ignores messages starting with "www." "http:" etc...
http://pastebin.ca/77236
By the way - i mostly used the guy a few post up's code, but tweaked it a bit.
edit: It does affect custom emoticons, unfortunately, but only if its the first character. Just press space before entering an emoticons.
Thanks bro. Works perfectly
|
|
07-03-2006 10:13 AM |
|
|
Sunshine
Elite Member
Posts: 5141 Reputation: 122
– / /
Joined: Mar 2004
Status: Away
|
RE: Capital letter & a dot
There's one very annoying bug in this script. If you select an emote from the emoticonpanel these do not get sent (empty line..only a . ), however they will be displayed if you type the shortcut.
If this can be fixed many people would be grateful...it's annoying when you have to type/remember all these shortcuts and this will probably be a reason for many not to use this script.
More bugs:
- dots get placed after everything, even if you end the sentence yourself with a . ? or !
- If you end a sentence yourself with a . and you type on the next word does not get capitalized (no double dot there though).
Additional info: i downloaded the script from http://www.msgpluslive.net/scripts/browse/index.php?act=view&id=35
This post was edited on 07-04-2006 at 02:48 PM by Sunshine.
|
|
07-03-2006 04:23 PM |
|
|
Dark_Nightmare
New Member
Posts: 2
33 / / –
Joined: Jul 2006
|
RE: RE: Capital letter & a dot
quote: Originally posted by Sunshine
Additional info: i downloaded the script from http://www.msgpluslive.net/scripts/browse/index.php?act=view&id=35
That script is different to the code i posted.
My code doesn't place a full stop after an exlamation mark, nor a question mark.
In regards to your emot problem - my script, again, doesnt have these problems.
Just so you know, this is the script you downloaded:
code: function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
sMessage = sMessage.substr(0,1).toUpperCase() + sMessage.substr(1) + '.'
return sMessage;
}
If you looked at my code, you would notice that it is far longer.
Please do not blame my code for another code's bugs!
Note: I use the term "my code" loosely. Code not 100% created by me - but i have tested, debuged, tested, debuged and then i tested and debugged some more.
|
|
07-04-2006 02:25 PM |
|
|
Sunshine
Elite Member
Posts: 5141 Reputation: 122
– / /
Joined: Mar 2004
Status: Away
|
RE: Capital letter & a dot
quote: Originally posted by Dark_Nightmare
Please do not blame my code for another code's bugs!
Well i'm sorry but i was under the impression this was the bug thread for the script that was released there...if your code is better why not work with the one who originally scripted it and update it on the script db?
I will edit out your quote in my previous post so the owner of the script can take it as a bugreport and request for his...
This post was edited on 07-04-2006 at 02:49 PM by Sunshine.
|
|
07-04-2006 02:37 PM |
|
|
Jellings
Full Member
Posts: 121
34 / / –
Joined: Dec 2004
|
RE: Capital letter & a dot
would it be possible to add a command or shortcut that would disabe the script for that message only?
|
|
07-04-2006 04:22 PM |
|
|
Farkie
New Member
Posts: 4
Joined: Jun 2006
|
RE: Capital letter & a dot
code: function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
lastchar = sMessage.substr(sMessage.length-1, sMessage.length);
switch(lastchar) {
case '?':
haschar = 1;
break;
case '}':
haschar = 1;
break;
case ')' :
haschar = 1;
break;
default:
haschar = 2;
break;
}
firstchar = sMessage.substr(0,1);
if(firstchar == '/') {
haschar = 4;
}
firstthree = sMessage.substr(0,7);
if(firstthree == '(!nor) ') {
haschar = 3;
}
if(haschar == '1') {
sMessage = sMessage.substr(0,1).toUpperCase() + sMessage.substr(1);
} else if (haschar == '2') {
sMessage = sMessage.substr(0,1).toUpperCase() + sMessage.substr(1) + '.';
} else if (haschar == '3') {
sMessage = sMessage.substr(7);
}
return sMessage;
}
I was working on a script like this lol, never realeased it though..
Usage:
(!nor) text - produces: text
text - produces: Text.
text? - produces: Text? (example a question)
text} - produces: Text} (example showing code)
text) - produces: Text) (most emoticons!)
/command parameter - produces: (result from command)
Hows that
This post was edited on 07-04-2006 at 10:34 PM by Farkie.
|
|
07-04-2006 10:21 PM |
|
|
AmbulanceX
Junior Member
[ rip the jacker ]
Posts: 79
35 / / –
Joined: Jul 2006
|
RE: Capital letter & a dot
thing that sucks with this is if u try to use commands they dont work.. eg: doing one of these /stealdp ends up as /stealdp. and wont work. so u have to go to the effort od turning capital letter and a dot script off...
Bulimic rainbows vomit what?, Burn Piano Island Burn!
|
|
07-08-2006 03:27 PM |
|
|
Pages: (5):
« First
«
1
2
3
[ 4 ]
5
»
Last »
|
|