What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » << Script for Quick texts >>

Pages: (2): « First « 1 [ 2 ] Last »
<< Script for Quick texts >>
Author: Message:
Jimbo
Veteran Member
*****

Avatar

Posts: 1650
Reputation: 18
32 / Male / Flag
Joined: Jul 2006
RE: << Script for Quick texts >>
Sorry, i forgot i couldn't put ' after a return
use this instead:
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if (Message.substr(0, 4)== "test"){
return'test1'
}
if (Message.substr(0, 4) == "cant"){
return'can"t'
}
if (Message.substr(0, 4) == "dont"){
return'don"t'
}
}

01-06-2007 11:46 AM
Profile E-Mail PM Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: << Script for Quick texts >>
ok i have fixed up my brothers code

code:
var original = new Array("dont","cant","test");//what you are changing from
var changed = new Array("don't","can't","test1");//what you are changing to
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
for(i in original){
Message = Message.replace(original[i],changed[i]);
}
return Message;
}

there you go :cheesy: (tested and it works)

jimbodude this is the better way.... just leave to to the pros :P
01-06-2007 12:12 PM
Profile PM Find Quote Report
Chestah
Veteran Member
*****

Avatar

Posts: 1658
Reputation: 34
36 / Male / –
Joined: Jun 2004
RE: << Script for Quick texts >>
quote:
Originally posted by Jimbodude
Sorry, i forgot i couldn't put ' after a return
use this instead:
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if (Message.substr(0, 4)== "test"){
return'test1'
}
if (Message.substr(0, 4) == "cant"){
return'can"t'
}
if (Message.substr(0, 4) == "dont"){
return'don"t'
}
}




Use nanafreak's code, the code above is verbose and unneccesarily long when you are working with alot of words and its biggest disadvantage is that it only parses the word if it is the first thing that is typed (and also only does one word).

ie 'dont' will get changed into 'don't'

but if you typed 'hello!! hey, dont do that', it will not be parsed.
Segosa is newb.
01-06-2007 12:28 PM
Profile E-Mail PM Web Find Quote Report
Double_N2
New Member
*


Posts: 10
Joined: Jan 2007
O.P. RE: << Script for Quick texts >>
Thanks everyone.
this one is working.

var original = new Array("dont","cant","test");//what you are changing from
var changed = new Array("don't","can't","test1");//what you are changing to
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
for(i in original){
Message = Message.replace(original[i],changed[i]);
}
return Message;
}

01-06-2007 01:02 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: << Script for Quick texts >>
Again, nobody succeeded in giving the right code.
code:
//By Jimbodud
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if (Message.substr(0, 4)== "test"){
return'test1'
}
if (Message.substr(0, 4) == "cant"){
return'can't'
}
if (Message.substr(0, 4) == "dont"){
return'don't'
}
}

This code will only match if the word is in front, and will forget the rest of the message. Example: "cant do that" gives "can't" without the "do that".
code:
//By NanaFreak
var original = new Array("dont","cant","test");//what you are changing from
var changed = new Array("don't","can't","test1");//what you are changing to
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
for(i in original){
Message = Message.replace(original[i],changed[i]);
}
return Message;
}
This code is better, only it's case-sensitive and it'll only replace one occurrence per array element. That's why markee was using RegExp's. So, the code which should do it:
code:
var original = new Array("dont","cant","test");//what you are changing from
var changed = new Array("don't","can't","test1");//what you are changing to
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
for(i in original){
Message = Message.replace(RegExp(original[i], "gi"), changed[i]);
}
return Message;
}
;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-06-2007 02:09 PM
Profile E-Mail PM Web Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: RE: << Script for Quick texts >>
quote:
Originally posted by Mattike
That's why markee was using RegExp's. So, the code which should do it:
code:
var original = new Array("dont","cant","test");//what you are changing from
var changed = new Array("don't","can't","test1");//what you are changing to
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
for(i in original){
Message = Message.replace(RegExp(original[i], "gi"), changed[i]);
}
return Message;
}
;)

Exactly, all I forgot was to re-define Message 8-)

* markee writes note to always use the scripting engine now on before posting any code
[Image: markee.png]
01-06-2007 04:00 PM
Profile PM Find Quote Report
Tochjo
forum super mod
******

Avatar

Posts: 4207
Reputation: 78
37 / Male / Flag
Joined: Sep 2003
RE: << Script for Quick texts >>
The two threads were merged and several posts were deleted. I hope the discussion can continue here without much problems :)
01-06-2007 05:26 PM
Profile PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« 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