What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Autotext + Name!

Pages: (2): « First « 1 [ 2 ] Last »
Autotext + Name!
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: Autotext + Name!
Why don't you use a for statement and arrays. Rather than all those if statement you only need one and you can then use Array[i].length for the length of the string rather than specifying a number.

EDIT: I thought I might help you out by giving you an example of what I was trying to say incase you didn't understand.  I just fixed up the code that you had posted.
code:
*/
var hi = 'Hi +Origin (:'
var on = '1'
var Array = new Array('HI","HALLO","HI@","HELLO","SEAS","ZEAS","HUHU","MOIN,"MORGEN","SERVUS","TAG","SERVAS");
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
if (Origin != Messenger.MyName){
Message = Message.toUpperCase()
for(i=0;i<Array.length;i++){
if (Message.substr(0,Array[i].lenght-1) == Array[i]){
ChatWnd.SendMessage('Hi ' + Origin + " (:" );
}
}
}
}
This will make it easier to extend on the script easier and fix any problem that you come accross because it is smaller and easier to read.

This post was edited on 08-17-2006 at 10:16 AM by markee.
[Image: markee.png]
08-17-2006 09:55 AM
Profile PM Find Quote Report
Gropfi
New Member
*

Avatar

Posts: 13
36 / Male / –
Joined: Jul 2006
O.P. RE: Autotext + Name!
AhRR :D

Thx...
i think i should read more tuts and learn more ;)

thanks ;)
08-17-2006 10:26 AM
Profile E-Mail PM Web Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: Autotext + Name!
If you don't like looking up MSDN all the time you can download a copy of it too right here.  I hope this is as useful to you as it has been to me.
[Image: markee.png]
08-17-2006 10:29 AM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Autotext + Name!
quote:
Originally posted by markee
If you don't like looking up MSDN all the time you can download a copy of it too right here.  I hope this is as useful to you as it has been to me.
It should be mandatory for anyone who script, alongside the Plus! scripting documentation tbh....
.-= A 'frrrrrrrituurrr' for Wacky =-.
08-17-2006 10:43 AM
Profile PM Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
Status: Online
RE: RE: Autotext + Name!
quote:
Originally posted by H-Des
It is working correct here.

Only remind that if both users would use this script you will get in a loop which you can't end...

No it won't.

MP!L has a flood protection on scripts ;)
YouTube closed-captions ripper (also allows you to download videos!)
08-17-2006 11:52 AM
Profile E-Mail PM Web Find Quote Report
H-Des
New Member
*


Posts: 2
Joined: Dec 2005
RE: RE: RE: Autotext + Name!
quote:
Originally posted by Mike
No it won't.

MP!L has a flood protection on scripts ;)


Ok, if you say so ... ;)

It came in a loop when I tested it by using 2 msn accounts at the same pc. But I didn't test it on another pc. ;)

This post was edited on 08-19-2006 at 10:16 AM by H-Des.
08-17-2006 01:15 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Autotext + Name!
quote:
Originally posted by Gropfi
what is wrong in this?
code:
var hi = 'Hi +Origin (:'

var hi = 'Hi' +Origin + '(:' ;

Origin is a variable. The rest is text (and thus must be enclosed in parenthesis).
Also don't forget to end each line with ";".

quote:
Originally posted by Gropfi
code:
ChatWnd.SendMessage('Hi '+Origin (: );

ChatWnd.SendMessage('Hi '+ Origin + '(:');

same reason as above.

quote:
Originally posted by Gropfi
code:
if (Message.substr(0,2) "morgen") {
and similar lines

if (Message.substr(0,6) == "morgen") {

You make a comparisson, so you need a comparisson operator between the two.

substr() is a function which takes a substring out of a given string. The syntax is substr(start,end). Since the length of "morgen" is 6 characters you need to specify to get the first 6 characters in the substr function which is done by substr(0, 6).


quote:
Originally posted by H-Des
It came in a loop when I tested it by using 2 msn accounts at the same pc. But I didn't test it on another pc.
It should have exactly the same outcome.

To avoid looping use regular expressions like RacePROuk showed. And with regular expressions you can also do what markee showed using an array btw.

This post was edited on 08-19-2006 at 09:54 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
08-19-2006 09:37 AM
Profile PM Find Quote Report
Sunshine
Elite Member
*****

Avatar

Posts: 5142
Reputation: 122
– / Female / Flag
Joined: Mar 2004
Status: Away
RE: Autotext + Name!
quote:
Originally posted by Silentdragon
If you like I could add this as an option in Answer Machine Plus.
Psttt... it's already possible with your script....people forget about the Plus! tags like (!N) ;)

Received: hi
Answer: hi (!N)
This outputs: hi <contact's friendly name>

This post was edited on 08-19-2006 at 10:42 AM by Sunshine.
[Image: 25dr3o9]
08-19-2006 10:31 AM
Profile E-Mail PM Web 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