[HELP] Messenger.MyPersonalMessage won't assign to variable? |
Author: |
Message: |
Kriogenic
Junior Member
I own all.
Posts: 15
34 / /
Joined: Aug 2007
|
O.P. [HELP] Messenger.MyPersonalMessage won't assign to variable?
Hey there I am currently making a script.
I have tried assigning my personal message to a variable and the variable has always come up empty... This is what I have done...
var MyOldPM = Messenger.MyPersonalMessage;
Debug.Trace("Personal Message is " + MyOldPM);
In the debug window this is what I see
"Personal Message is "
This tells me that MyOldPM is turning up as an empty variable...
Can some one please help me with this? I don't see any reason why it should not work...
Thanks,
Kriogenic.
|
|
08-10-2007 12:17 AM |
|
|
GNSPS
Junior Member
Coding is man's best friend...
Posts: 40
32 / /
Joined: Oct 2006
|
RE: [HELP] Messenger.MyPersonalMessage won't assign to variable?
Have you got something in your PSM at all?
I can't see any reason for it not being working either...
|
|
08-10-2007 12:26 AM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: [HELP] Messenger.MyPersonalMessage won't assign to variable?
try
code: Debug.Trace("Personal Messages is " + Messenger.MyPersonalMessage);
and make sure that it's not the property that is an empty string for some reason
<Eljay> "Problems encountered: shit blew up"
|
|
08-10-2007 12:26 AM |
|
|
Kriogenic
Junior Member
I own all.
Posts: 15
34 / /
Joined: Aug 2007
|
O.P. RE: [HELP] Messenger.MyPersonalMessage won't assign to variable?
I tried
Trace.Debug("Personal Message is " + Messenger.MyPersonalMessage);
and I get
"Personal Message is testing pm is not empty
(My pm was set to testing pm is not empty)
So it is working I just have no idea why it won't assign to the variable I can set a new PM using Messenger.MyPersonalMessage = "New PM"; it just wont allow me to assign the variable Wierd...
Kriogenic.
|
|
08-10-2007 12:33 AM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: [HELP] Messenger.MyPersonalMessage won't assign to variable?
can you copy and paste the whole code in a post for me please in code tags? eg:
[code]
...
...
...
[/code]
<Eljay> "Problems encountered: shit blew up"
|
|
08-10-2007 12:34 AM |
|
|
GNSPS
Junior Member
Coding is man's best friend...
Posts: 40
32 / /
Joined: Oct 2006
|
RE: [HELP] Messenger.MyPersonalMessage won't assign to variable?
For me it works just fine... Yeah you would have to post the whole code because it must be any other statement messing around with the PSM...
|
|
08-10-2007 12:39 AM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [HELP] Messenger.MyPersonalMessage won't assign to variable?
He is either doing it outside of a function or on initialize and the Object isn't filled yet because the user isn't signed in.
code: var myOldPsm;
function OnEvent_Initalize(bMessengerStart) {
if (Messenger.MyStatus < 2) return false;
myOldPsm = Messenger.MyPersonalMessage;
}
function OnEvent_SigninReady() {
OnEvent_Intialize(true);
}
This post was edited on 08-10-2007 at 12:47 AM by matty.
|
|
08-10-2007 12:45 AM |
|
|
Kriogenic
Junior Member
I own all.
Posts: 15
34 / /
Joined: Aug 2007
|
O.P. RE: [HELP] Messenger.MyPersonalMessage won't assign to variable?
Sure.....
code: function OnEvent_ChatWndSendMessage( ChatWnd, Message )
{
chat_window = ChatWnd;
Command = Message.split(' ')
switch ( Command[0].toLowerCase() )
{
case "/testing" :
var i = 0;
var TheOldPm = Messenger.MyPersonalMessage;
MsgPlus.AddTimer("testing", 1000 );
Message = '';
return "";
break;
default:
}
return Message;
}
function OnEvent_Timer( TimerId )
{
switch( TimerId )
{
case 'testing':
i++
if(i < 60){
Messenger.MyPersonalMessage = "Timing... " + i + " Minutes have passed";
MsgPlus.AddTimer( 'cuptime', 60000 );
}else{
Messenger.MyPersonalMessage = MyOldPM;
}
break;
default:
}
}
Now this is just the basis of my script... I am going to build on it make it so people can change how many minutes and what the message will say right now... After an hour the PM gets reset to normal... Lots for to do on the script its just a basis...
Thanks,
Kriogenic.
This post was edited on 08-10-2007 at 12:48 AM by Kriogenic.
|
|
08-10-2007 12:45 AM |
|
|
GNSPS
Junior Member
Coding is man's best friend...
Posts: 40
32 / /
Joined: Oct 2006
|
RE: [HELP] Messenger.MyPersonalMessage won't assign to variable?
You've got the variable wrong it isn't outputing anything because you're initializing it inside OnEvent_ChatWndSendMessage() function... if you put it like this it should work:
[code]
var MyOldPM;
function OnEvent_ChatWndSendMessage( ChatWnd, Message )
{
chat_window = ChatWnd;
Command = Message.split(' ')
switch ( Command[0].toLowerCase() )
{
case "/testing" :
var i = 0;
MyOldPm = Messenger.MyPersonalMessage;
MsgPlus.AddTimer("testing", 1000 );
Message = '';
return "";
break;
default:
}
return Message;
}
function OnEvent_Timer( TimerId )
{
switch( TimerId )
{
case 'cuptime':
i++
if(i < 60){
Messenger.MyPersonalMessage = "Timing... " + i + " Minutes have passed";
MsgPlus.AddTimer( 'cuptime', 60000 );
}else{
Messenger.MyPersonalMessage = MyOldPM;
}
break;
default:
}
}
[code]
EDIT: you also got the variable name wrong you've got The in one and My on another! Hope this works...
This post was edited on 08-10-2007 at 12:51 AM by GNSPS.
|
|
08-10-2007 12:50 AM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [HELP] Messenger.MyPersonalMessage won't assign to variable?
code: var chat_window;
var TheOldPm;
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
chat_window = ChatWnd;
Command = Message.split(' ')
switch ( Command[0].toLowerCase() ){
case "/testing" :
var i = 0;
TheOldPm = Messenger.MyPersonalMessage;
MsgPlus.AddTimer("testing", 1000 );
Message = '';
return "";
break;
}
return Message;
}
function OnEvent_Timer(TimerId) {
switch(TimerId){
case 'cuptime':
i++
if(i < 60){
Messenger.MyPersonalMessage = "Timing... " + i + " Minutes have passed";
MsgPlus.AddTimer('cuptime', 60000);
}
else{
Messenger.MyPersonalMessage = TheOldPM;
}
break;
}
}
The problem is is that you are declaring TheOldPm inside a function making it local to the function, however you are trying to use a variable called MyOldPm.
This post was edited on 08-10-2007 at 12:53 AM by matty.
|
|
08-10-2007 12:50 AM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|