[Help] Replacing Text Using Scripts (I think I'm dumb lol) |
Author: |
Message: |
aNILEator
Skinning Contest Winner
...in the wake of the aNILEator
Posts: 3718 Reputation: 90
35 / /
Joined: Oct 2003
Status: Away
|
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
why don't you just simply edit the txt file in autocorrector.....?
|
|
07-12-2006 06:22 PM |
|
|
Silentdragon
Full Member
if(life==null && wrists) EmoAlert();
Posts: 148 Reputation: 2
34 / / –
Joined: Jun 2006
|
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
My script detects links and ignores them when apply the text modifications.
|
|
07-12-2006 07:25 PM |
|
|
Joereynolds89
Junior Member
Posts: 69
Joined: Jul 2006
|
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
because theres too much unneeded code, i thought creating a personal font would be sooo much easier
So what would the script be to ignore any changes if / , http or www is at the start and to change every instance of one letter to another pai just confused me, im an amateur scripter
EDIT: maybe something i did wrong last time, pais thing now works, ill test the ignorance if certain values are found next, but big thanx to pia
EDIT2:
How would i make it so changes dont occur if www, http or / is displayed anywhere within the message?? thanks
code: function OnEvent_Initialize(MessengerStart)
{
}
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
sMessage = sMessage.replace(/a/g,"A");
sMessage = sMessage.replace(/b/g,"B");
sMessage = sMessage.replace(/c/g,"C");
sMessage = sMessage.replace(/d/g,"D");
sMessage = sMessage.replace(/e/g,"E");
sMessage = sMessage.replace(/f/g,"F");
sMessage = sMessage.replace(/g/g,"G");
sMessage = sMessage.replace(/h/g,"H");
sMessage = sMessage.replace(/i/g,"I");
sMessage = sMessage.replace(/j/g,"J");
sMessage = sMessage.replace(/k/g,"K");
sMessage = sMessage.replace(/l/g,"L");
sMessage = sMessage.replace(/m/g,"M");
sMessage = sMessage.replace(/n/g,"N");
sMessage = sMessage.replace(/o/g,"O");
sMessage = sMessage.replace(/p/g,"P");
sMessage = sMessage.replace(/q/g,"Q");
sMessage = sMessage.replace(/r/g,"R");
sMessage = sMessage.replace(/s/g,"S");
sMessage = sMessage.replace(/t/g,"T");
sMessage = sMessage.replace(/u/g,"U");
sMessage = sMessage.replace(/v/g,"V");
sMessage = sMessage.replace(/w/g,"W");
sMessage = sMessage.replace(/x/g,"X");
sMessage = sMessage.replace(/y/g,"Y");
sMessage = sMessage.replace(/z/g,"Z");
return sMessage;
}
function OnEvent_Uninitialize(MessengerExit)
{
}
The replacment with capitals is just for example, there will be symbols here instead so no comments about using .toUppercase please
Joe
This post was edited on 07-12-2006 at 08:18 PM by Joereynolds89.
|
|
07-12-2006 07:51 PM |
|
|
segosa
Community's Choice
Posts: 1407 Reputation: 92
Joined: Feb 2003
|
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
Here's code which will replace the letters for you. Might be a bit buggy as I didn't do extensive testing, however it works.
code: function fuck_up_string(str)
{
var a = [ 'a','B','C','D','e','F','G','H','i','J','K','L','M','N','o','P','Q','R','S','T','u','V','W','X','Y','Z' ];
var o = "", c;
str = str.toLowerCase();
for (var i = 0; i < str.length; i++)
{
c = str.charCodeAt( i );
if (c >= 97 && c <= 122)
o += a[c - 97];
else o += str.charAt( i );
}
return o;
}
You see that?
code: var a = [ 'a','B','C','D','e','F','G','H','i','J','K','L','M','N','o','P','Q','R','S','T','u','V','W','X','Y','Z' ];
It will replace the letters a to z with the contents of that. As you can see in my testing I simply made the vowels lowercase. If I sent a message like "this is a test" I got "THiS iS a TeST".
This post was edited on 07-12-2006 at 09:51 PM by segosa.
The previous sentence is false. The following sentence is true.
|
|
07-12-2006 09:35 PM |
|
|
Pai
Full Member
w00t !
Posts: 203 Reputation: 2
– / / –
Joined: Sep 2003
|
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
quote: Originally posted by Joereynolds89
How would i make it so changes dont occur if www, http or / is displayed anywhere within the message?? thanks
You use:
code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
if (!sMessage.match('www') && !sMessage.match('http')) { // no link found, replace stuff
// here put the code that I showed you (that you used in your reply) or use segosa's (dunno if it works, just taking his word for it)
}
}
|
|
07-13-2006 12:43 AM |
|
|
segosa
Community's Choice
Posts: 1407 Reputation: 92
Joined: Feb 2003
|
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
Try this:
code: function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
if (!sMessage.match('www') && !sMessage.match('http') && sMessage.charAt(0) != '/')
{
var a = [ 'a','B','C','D','e','F','G','H','i','J','K','L','M','N','o','P','Q','R','S','T','u','V','W','X','Y','Z' ];
var o = "", c;
str = str.toLowerCase();
for (var i = 0; i < str.length; i++)
{
c = str.charCodeAt( i );
if (c >= 97 && c <= 122)
o += a[c - 97];
else o += str.charAt( i );
}
return o;
}
return sMessage;
}
The previous sentence is false. The following sentence is true.
|
|
07-13-2006 08:54 AM |
|
|
Joereynolds89
Junior Member
Posts: 69
Joined: Jul 2006
|
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
lol thankyou Pai, finally got it all working if anyone actually wants to use it ill upload but all it does is change your font but i wanted it Thankyou to everyone that helped!
Segosa, i did all yours, i dont understand yours as i do Pai's but it didnt work
code: function OnEvent_Initialize(MessengerStart)
{
}
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
if (!sMessage.match('www') && !sMessage.match('http') && sMessage.charAt(0) != '/')
{
var a = [ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' ];
var o = "", c;
str = str.toLowerCase();
for (var i = 0; i < str.length; i++)
{
c = str.charCodeAt( i );
if (c >= 97 && c <= 122)
o += a[c - 97];
else o += str.charAt( i );
}
return o;
}
return sMessage;
}
function OnEvent_Uninitialize(MessengerExit)
{
}
Remember capitals are only for example
|
|
07-13-2006 09:57 AM |
|
|
segosa
Community's Choice
Posts: 1407 Reputation: 92
Joined: Feb 2003
|
RE: RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
quote: Originally posted by Joereynolds89
lol thankyou Pai, finally got it all working if anyone actually wants to use it ill upload but all it does is change your font but i wanted it Thankyou to everyone that helped!
Segosa, i did all yours, i dont understand yours as i do Pai's but it didnt work
code: function OnEvent_Initialize(MessengerStart)
{
}
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
if (!sMessage.match('www') && !sMessage.match('http') && sMessage.charAt(0) != '/')
{
var a = [ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' ];
var o = "", c;
str = str.toLowerCase();
for (var i = 0; i < str.length; i++)
{
c = str.charCodeAt( i );
if (c >= 97 && c <= 122)
o += a[c - 97];
else o += str.charAt( i );
}
return o;
}
return sMessage;
}
function OnEvent_Uninitialize(MessengerExit)
{
}
Remember capitals are only for example
Crap, sorry, I forgot to change something.
Since you've already got your own working, it won't matter, but here's the working code:
code: function OnEvent_Initialize(MessengerStart)
{
}
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
if (!sMessage.match('www') && !sMessage.match('http') && sMessage.charAt(0) != '/')
{
var a = [ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' ];
var o = "", c;
var str = sMessage.toLowerCase();
for (var i = 0; i < str.length; i++)
{
c = str.charCodeAt( i );
if (c >= 97 && c <= 122)
o += a[c - 97];
else o += str.charAt( i );
}
return o;
}
return sMessage;
}
function OnEvent_Uninitialize(MessengerExit)
{
}
The previous sentence is false. The following sentence is true.
|
|
07-13-2006 10:04 AM |
|
|
Pages: (3):
« First
«
1
2
[ 3 ]
Last »
|
|
|