[Help] Replacing Text Using Scripts (I think I'm dumb lol) |
Author: |
Message: |
aNILEator
Skinning Contest Winner
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://www.anileator.com/wp-content/uploads/shead.png)
...in the wake of the aNILEator
Posts: 3718 Reputation: 90
35 / / ![United Kingdom Flag](images/flags/gb.png)
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 |
|
![](images/pixel.gif) |
Silentdragon
Full Member
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](avatar.php?uid=57163-12124)
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 |
|
![](images/pixel.gif) |
Joereynolds89
Junior Member
![*](images/star.gif) ![*](images/star.gif)
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 ![:S](images/smilies/msn_confused.gif) 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 |
|
![](images/pixel.gif) |
segosa
Community's Choice
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
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 |
|
![](images/pixel.gif) |
Pai
Full Member
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
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 |
|
![](images/pixel.gif) |
segosa
Community's Choice
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
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 |
|
![](images/pixel.gif) |
Joereynolds89
Junior Member
![*](images/star.gif) ![*](images/star.gif)
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 ![:(](images/smilies/msn_sad.gif) if anyone actually wants to use it ill upload but all it does is change your font ![:S](images/smilies/msn_confused.gif) but i wanted it ![:P](images/smilies/msn_tongue.gif) Thankyou to everyone that helped!
Segosa, i did all yours, i dont understand yours as i do Pai's ![:P](images/smilies/msn_tongue.gif) 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 ![:D](images/smilies/msn_grin.gif)
|
|
07-13-2006 09:57 AM |
|
![](images/pixel.gif) |
segosa
Community's Choice
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
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 ![:(](images/smilies/msn_sad.gif)
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 ![:D](images/smilies/msn_grin.gif)
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 |
|
![](images/pixel.gif) |
Pages: (3):
« First
«
1
2
[ 3 ]
Last »
|
|
|