SP3 - MsgPlus Script Problem |
Author: |
Message: |
bigbob85
Full Member
Is Good, Is Bob...
Posts: 128 Reputation: 4
37 / /
Joined: Jul 2003
|
O.P. SP3 - MsgPlus Script Problem
I found out about this problem when I couldn't figure out why my script wasn't working.
NOTE : Only happens with the new SP3 Timestamps
If you are using a OnEvent_ChatWndReceiveMessage (and possibly other functions aswel) and you compare the Origin to Messenger.MyName to find out if the message was from you. It will get Messenger.MyName alright, but when it gets the origin, it includes the time stamp.
So, Origin != Messenger.MyName
Anyone know any possible fixes?
|
|
03-08-2007 09:57 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: SP3 - MsgPlus Script Problem
|
|
03-08-2007 10:07 PM |
|
|
Felu
Veteran Member
Posts: 2223 Reputation: 72
30 / /
Joined: Apr 2006
Status: Away
|
RE: SP3 - MsgPlus Script Problem
quote: Originally posted by Matty
CookieRevised's reply to [Fix] Problem with OnEvent_ChatWndRecieveMessage's Origin
quote: Originally posted by Matty
it gets the origin, it includes the time stamp.
So you'll need to put the TimeStamp before the Message aswell. It is stored here -> HKEY_LOCAL_MACHINE\SOFTWARE\iAvatars.com\StuffPlug\Messenger.MyUserID\szTimestamp. Place that before the ChatOnly Name and then use Regular Expressions to match the HH mm ss, etc .
|
|
03-09-2007 04:07 AM |
|
|
markee
Veteran Member
Posts: 1622 Reputation: 50
36 / /
Joined: Jan 2006
|
RE: SP3 - MsgPlus Script Problem
Looks like there is going to be conflicts every time TB adds more features that change the messages received..... Let us hope that TB fore-warns us of possible upcoming problems so we ca release updates for scripts to minimise conflicts (it would be nice, but I doubt it will happen). But this still doesn't fix the problem with old scripts that don't get updated and when people do not update their scripts as well.
Maybe we should just hope and pray that TB doesn't make any updates that might cause problems instead....
|
|
03-09-2007 01:18 PM |
|
|
J-Thread
Full Member
Posts: 467 Reputation: 8
– / / –
Joined: Jul 2004
|
RE: SP3 - MsgPlus Script Problem
I don't think TB is aware of this problem, but I doubt he will change anything because it will be hard to implement timestamps in a different way...
|
|
03-09-2007 03:35 PM |
|
|
TheGuruSupremacy
Full Member
Posts: 367 Reputation: 19
34 / /
Joined: Nov 2006
|
RE: SP3 - MsgPlus Script Problem
Try to use this code
code: function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind )
{var Contacts = ChatWnd.Contacts
var Contact = new Array()
var e = new Enumerator(Contacts)
var i =0
for(;!e.atEnd();e.moveNext()){
Contact[i] = e.item().Name
Debug.Trace(Contact[i])
i++}
for(var y=0;y<Contact.length;y++){
if (Origin==Contact[y]){
ChatWnd.SendMessage("OOOOOOOOOOOOOOOK")}}
};
|
|
03-09-2007 04:43 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: SP3 - MsgPlus Script Problem
quote: Originally posted by TheGuruSupremacy
Try to use this code
Note that this will only work to look for received messages sent by someone else. You can't use it to modify the way your own messages are displayed on your side, because ChatWnd.Contacts only include the contacts in a chat window except the active Messenger user. Therefore, you can't use that to compare it to your name.
This post was edited on 03-09-2007 at 05:37 PM by Matti.
|
|
03-09-2007 05:37 PM |
|
|
TheGuruSupremacy
Full Member
Posts: 367 Reputation: 19
34 / /
Joined: Nov 2006
|
RE: SP3 - MsgPlus Script Problem
quote: Originally posted by Mattike
quote: Originally posted by TheGuruSupremacy
Try to use this code
Note that this will only work to look for received messages sent by someone else. You can't use it to modify the way your own messages are displayed on your side, because ChatWnd.Contacts only include the contacts in a chat window except the active Messenger user. Therefore, you can't use that to compare it to your name.
I don't think it....It's true that ChatWnd.Contacts only include the contacts in a chat window except the active Messenger user but you can compare with your name using syntax if....else...
Function Example:
code: function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind )
{var Contacts = ChatWnd.Contacts
var Contact = new Array()
var e = new Enumerator(Contacts)
var AmI = new Boolean()
var i =0
Debug.Trace("Chatting with ")
for(;!e.atEnd();e.moveNext()){
Contact[i] = e.item().Name
Debug.Trace(Contact[i])
i++}
for(var y=0;y<Contact.length;y++){
if (Origin==Contact[y]){
AmI=false}else{
AmI=true
break}
}
Debug.Trace("Message: " + Message)
Debug.Trace("Have i written this message???" + AmI)
}
However i have checked that it can not work with timestamp because not only your name is modificated but also contact's name...you can use this code
code: function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind )
{var time = new Date()
var hours = time.getHours()
var minutes = time.getMinutes()
var seconds = time.getSeconds()
var Myformattednick = "[" + hours + "." + minutes + "." + seconds + "]" + " " + Messenger.MyName
Debug.Trace(Myformattednick)
Debug.Trace(Origin)
if (Myformattednick!=Origin){
//do anything
}else{//do else
}
}
This post was edited on 03-09-2007 at 08:50 PM by TheGuruSupremacy.
|
|
03-09-2007 05:41 PM |
|
|
markee
Veteran Member
Posts: 1622 Reputation: 50
36 / /
Joined: Jan 2006
|
RE: RE: SP3 - MsgPlus Script Problem
quote: Originally posted by TheGuruSupremacy
code: function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind )
{var time = new Date()
var hours = time.getHours()
var minutes = time.getMinutes()
var seconds = time.getSeconds()
var Myformattednick = "[" + hours + "." + minutes + "." + seconds + "]" + " " + Messenger.MyName
Debug.Trace(Myformattednick)
Debug.Trace(Origin)
if (Myformattednick!=Origin){
//do anything
}else{//do else
}
}
You can't use that, just use a regular expression to omit the time stamp when the registry setting for StuffPlug has the feature enabled. It is also probable wise to add this to CookieRevised's code that was linked to earlier.
EDIT: The reason for the regular expression to omit the time stamp (probably a replace method is best) is because the seconds/minutes/hours could change between when stuffplug adds the time stamp and the script removes it (eg. stuff plug adds the time at 23:59:59 (and 999 milliseconds) at the 31st of december then when your script gets to it, it will already be a new year and ever value has changed and will not be the same). I hope this gives you explanation rather than just saying it is wrong.
I do stress to add this to CookieRevised's code and to also check to see if the registry setting has the feature enabled before going through your method.
This post was edited on 03-10-2007 at 04:53 AM by markee.
|
|
03-10-2007 04:48 AM |
|
|
bigbob85
Full Member
Is Good, Is Bob...
Posts: 128 Reputation: 4
37 / /
Joined: Jul 2003
|
O.P. RE: SP3 - MsgPlus Script Problem
I'd assume its the same (or similar) time tags to MsgPlus Live.
quote: Originally posted by http://www.msgpluslive.net/help/registry/
Time Tags
Enclose text in single quotes. Example: "HH':'mm" will produce "11:40" for 11:40am.
* h - Hours with no leading zero for single-digit hours; 12-hour clock.
* hh - Hours with leading zero for single-digit hours; 12-hour clock.
* H - Hours with no leading zero for single-digit hours; 24-hour clock.
* HH - Hours with leading zero for single-digit hours; 24-hour clock.
* m - Minutes with no leading zero for single-digit minutes.
* mm - Minutes with leading zero for single-digit minutes.
* s - Seconds with no leading zero for single-digit seconds.
* ss - Seconds with leading zero for single-digit seconds.
* t - One character time-marker string, such as A or P.
* tt - Multicharacter time-marker string, such as AM or PM.
Date Tags
Enclose text in single quotes. Example: "dd'/'MM" will produce "18/10" for October 18th.
* d - Day of month as digits with no leading zero for single-digit days.
* dd - Day of month as digits with leading zero for single-digit days.
* ddd - Day of week as a three-letter abbreviation.
* dddd - Day of week as its full name.
* M - Month as digits with no leading zero for single-digit months.
* MM - Month as digits with leading zero for single-digit months.
* MMM - Month as a three-letter abbreviation.
* MMMM - Month as its full name.
* yy - Year as last two digits, but with leading zero for years less than 10.
* yyyy - Year represented by full four digits.
Is there any time("h") sort of function?
|
|
03-10-2007 05:20 AM |
|
|
Pages: (3):
« First
[ 1 ]
2
3
»
Last »
|
|