quote:
Originally posted by SpunkyLoveMuff
I have declared variables out of functions etc in other scripts but didn't define the type so just using something like
code:
var Myvar;
var myVar = "";
That's no problem.
The value assigned to the variable isn't important (JScript changes the type of the variable on the fly if it needs to be anyway), as long as it is declared with the var statement that's enough....
I assigned values to the global variables using the new operator in the script I attached because:
1) it is easy to see what the variable is going to be used as.
2) it also initializes the variables to the proper values (especially important for the DateTimeSet variable which is assign the current date and time at that point when the script initializes).
quote:
Originally posted by rockie
edit: for some reason, after.. i set busy away... busy.. a bunch of times, restarted messenger, the scripts popup window asking you for the reason, won't popup asking anymore, however it does set me to away .. just with <no reason> (i did edit the script so it didnt use the /me command, and took out the bold tags, dont' know if that had any affect, worked for a bit
The error is mostlikely on your part (missing the popup window because it is behind other windows for example) since as you can see from the code, nothing can go wrong with it as it is very very very basic:
code:
function OnEvent_MyStatusChange(NewStatus) {
// Reset stuff
Reason = "";
CheckArray.length = 0;
DateTimeSet = new Date();
// Show reason window when status is away or busy
if (NewStatus === 4 || NewStatus === 7) {
MsgPlus.CreateWnd("interface.xml","Main");
}
}
It does nothing more than resetting the reason, the array with emails to check and the datetime each time you change status. And if the new status is either Away or Busy it shows the popup window.
In fact, since it shows the popup each time you change status to away or busy and since you didn't set any reason, you mostlikely would ended up with a whole bunch of popup windows (this can be overcome by adding a check for it before the window is created though; but that isn't the issue here).
(also note that the script doesn't set any status, it reacts on status change)