What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Looking for a simple script

Looking for a simple script
Author: Message:
yergsbah
New Member
*


Posts: 2
Joined: May 2009
O.P. Looking for a simple script
I want a script that changes a line in a message to a certain color when I put a symbol at the start and everything within quotes to a different color.

For example:

~This line turns green.
This one doesn't.

"This line turns red.
This one does too."

Does this kind of script already exist? If it doesn't, how would I go about making it?
05-06-2009 10:54 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: Looking for a simple script
Colour will only work with MP!L btw... Can't test these as I've just got to work...

Javascript code:
Message = Message.split("\n");
for( var s in Message){
    if(Message[s].substr(0,1)=="~"){
        Message[s] = "[a=3]"+Message[s]+"[/a]";
    }
}
Message = Message.join("\n");
 
Message = Message.replace(/\"(.+)\"/gi, "[c=4]\"$1\"[/c]");


The highlighted line probably has a bug if someone would like to correct it :p

EDIT: Ok, I'm a bit rusty it seems ^o) Time to get working on top secret scripts every second I can get away from family :p

This post was edited on 05-07-2009 at 06:19 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
05-07-2009 06:14 AM
Profile PM Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: Looking for a simple script
the regex needs to be changed to this:
Javascript code:
/[\"](.+?)[\"]/gi

it was just placing it around the whole message

so the highlighted line would be:
Javascript code:
Message = Message.replace(/[\"](.+?)[\"]/gi, "[c=4]\"$1\"[/c]");


well atleast i think it should work... i did it in PHP =p

This post was edited on 05-07-2009 at 09:42 AM by NanaFreak.
05-07-2009 06:30 AM
Profile PM Find Quote Report
yergsbah
New Member
*


Posts: 2
Joined: May 2009
O.P. RE: Looking for a simple script
Thanks
05-07-2009 09:13 AM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: Looking for a simple script
quote:
Originally posted by NanaFreak
the regex needs to be changed to this:
Javascript code:
/[\"](.+?)[\"]/gi

it was just placing it around the whole message

so the highlighted line would be:
Javascript code:
Message = Message.replace/[\"](.+?)[\"]/gi, "[c=4]\"$1\"[/c]");


well atleast i think it should work... i did it in PHP =p

Just for my benefit now... how do the square brackets help? I thought they were just for character sets
<Eljay> "Problems encountered: shit blew up" :zippy:
05-07-2009 09:38 AM
Profile PM Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: Looking for a simple script
quote:
Originally posted by Spunky
quote:
Originally posted by NanaFreak
the regex needs to be changed to this:
Javascript code:
/[\"](.+?)[\"]/gi

it was just placing it around the whole message

so the highlighted line would be:
Javascript code:
Message = Message.replace/[\"](.+?)[\"]/gi, "[c=4]\"$1\"[/c]");


well atleast i think it should work... i did it in PHP =p

Just for my benefit now... how do the square brackets help? I thought they were just for character sets
it makes it go around a set of quotes... where yours would do it around the whole string if there were quotes in it... i dunno how the [] make it work but in php they work...
05-07-2009 09:42 AM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: Looking for a simple script
quote:
Originally posted by NanaFreak
it makes it go around a set of quotes... where yours would do it around the whole string if there were quotes in it... i dunno how the [] make it work but in php they work...

but it can only replace the quotes and it's contents as thats all that is being matched right? From what I can see they should be near identical
<Eljay> "Problems encountered: shit blew up" :zippy:
05-07-2009 10:09 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On