Shoutbox

<< Script for Quick texts >> - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: << Script for Quick texts >> (/showthread.php?tid=70350)

Quick Texts - Help ! by Double_N2 on 01-05-2007 at 03:55 PM

Hello.
I've just noticed the Quick Texts option is limited. you can have only 200 quick texts in it. Does someone know if i can somehow add more?
Does someone know any script that does the same thing which i can use ? please help me.
Thanks.


RE: Quick Texts - Help ! by CookieRevised on 01-05-2007 at 05:45 PM

Why do you need more than 200 quicktexts??? Do you even remember them all?

Anyways, if you want more, you better switch entirely to a script (which doesn't exists yet, since nobody ever needed more than 200 quicktexts :p)


RE: Quick Texts - Help ! by Double_N2 on 01-05-2007 at 08:46 PM

I use it to add capital letters and " ' " on the right places.
thats why i need more than 200.
2000 would be fine.


RE: << Script for Quick texts >> by markee on 01-06-2007 at 03:37 AM

This script will do it but the only problem is that you have to hard code them into the script yourself.  I could make something a bit more complex that will do the job for you but i cba.  I have given you some examples of how to hard code them in, you just use the first 2 lines and they must match up to the on you are changing it to.  I hope you like it.

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


EDIT: thanks roflmao for fixing me up, teaches me right for writing scripts straight into a post :tongue:

EDIT2: fixed the problem that mattike pointed out on the second page.  hopefully i have learned my lesson now
RE: << Script for Quick texts >> by roflmao456 on 01-06-2007 at 03:42 AM

quote:
Originally posted by markee

code:
function OnEvent_MessageSent(ChatWnd,Message)


that should be
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)

correct me if im wrong lolz :S

RE: << Script for Quick texts >> by Double_N2 on 01-06-2007 at 10:39 AM

It doesn't work...


RE: << Script for Quick texts >> by Jimbo on 01-06-2007 at 10:50 AM

quote:
Originally posted by Double_N2
It doesn't work...
Did you try adding more quick texts to the script? if so, post your code so we can have a look at it.
RE: << Script for Quick texts >> by Double_N2 on 01-06-2007 at 10:56 AM

"test" is supposed to change to "test1"

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.replace(RegExp(original[i],"gi"),changed[i]);
}
return Message;
}


RE: << Script for Quick texts >> by Jimbo on 01-06-2007 at 11:39 AM

Rushed a bit but its basically what you want

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'
}
}

To add more just copy and past one of the if commands then change the Message.substr(0, 4) to how ever many letters it is. For example the word hello would have
code:
Message.substr(0, 5)
because it has 5 letters etc
If you need any more help, just ask
RE: << Script for Quick texts >> by Double_N2 on 01-06-2007 at 11:43 AM

When i click "apply" it writes the following error :
"coudn't start script "quick texts 1". The script may be defective or you may not have the proper privelleges to run scripts."


RE: << Script for Quick texts >> by Jimbo on 01-06-2007 at 11:46 AM

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'
}
}


RE: << Script for Quick texts >> by NanaFreak on 01-06-2007 at 12:12 PM

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
RE: << Script for Quick texts >> by Chestah on 01-06-2007 at 12:28 PM

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.
RE: << Script for Quick texts >> by Double_N2 on 01-06-2007 at 01:02 PM

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;
}


RE: << Script for Quick texts >> by Matti on 01-06-2007 at 02:09 PM

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;
}
;)
RE: RE: << Script for Quick texts >> by markee on 01-06-2007 at 04:00 PM

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
RE: << Script for Quick texts >> by Tochjo on 01-06-2007 at 05:26 PM

The two threads were merged and several posts were deleted. I hope the discussion can continue here without much problems :)