All I did was clean the code up so far, it looks like it
should work.
Found an error just as I posted, GetHours() and GetMinutes() are functions of the Date() object in Javascript, you have to declare it before you can use it, hence the var mDate = new Date();
Also you cannot assign the PSM OnEvent_Signin as that is when the user is signing in, it would have to be OnEvent_SigninReady however once you signout the script is stopped until you sign back in so you will loose any variables that have been set.
code:
var PreviousToTimerPSM;
var mDate = new Date();
function OnEvent_Signout(Email) {
Messenger.MyPersonalMessage = PreviousToTimerPSM; //restores the original PSM while signing out?
}
function OnEvent_SigninReady(Email) {
PreviousToTimerPSM = Messenger.MyPersonalMessage; //retrieves the previous PSM once the user is signed in?
}
function OnEvent_MyStatusChange(NewStatus) {
if( NewStatus == 3 ) {
Messenger.MyPersonalMessage = PreviousToTimerPSM; //if it's online, no need to count.
} else if( NewStatus == 6 ) {
Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.GetHours()+":"+mDate.GetMinutes();
} else if( NewStatus == 4 ) {
Messenger.MyPersonalMessage = "Estou ocupado desde "+mDate.GetHours()+":"+mDate.GetMinutes();
} else if( NewStatus == 5 ) {
Messenger.MyPersonalMessage = "Saí às "+mDate.GetHours()+":"+mDate.GetMinutes()+" mas volto logo!";
} else if( NewStatus == 7 ) {
Messenger.MyPersonalMessage = "Estou ausente desde "+mDate.GetHours()+":"+mDate.GetMinutes();
} else if( NewStatus == 8 ) {
Messenger.MyPersonalMessage = "Estou em uma ligação desde "+mDate.GetHours()+":"+mDate.GetMinutes();
} else if( NewStatus == 9 ) {
Messenger.MyPersonalMessage = "Estou almoçando desde "+mDate.GetHours()+":"+mDate.GetMinutes();
}
}