quote:
Originally posted by alexp2_ad
quote:
Originally posted by Zeh
LOL ok. But isn't there any way of putting each of them in a diferent line with colors? Even if it would take a more complecated code?
No.
Actually, patchou should make a function for a toast that line wraps and uses colours...
Use the newline character like you can in every other string in JScript:
\n
and if that doesn't work try to use:
\x0D
and if that doesn't work, slap Patchou
EDIT: and it doesn't work, so let us slap Patchou...
quote:
Originally posted by SpunkyLoveMuff
ALT codes don't seem to go into the script very well (It'd be ALT+0015 for carriage return).
ALT+0015 is certainly not a carriage return. The decimal ascii for a CR is 13
(and thus 0x0D in hexadecimal, see above)...
------------------------------------------
about
alexp2_ad's code the code alexp2_ad posted (which isn't his!...
@alex):
optimized:
code:
function OnEvent_SigninReady(sEmail) {
var online = 0;
var offline = 0;
for (var e = new Enumerator(Messenger.MyContacts); !e.atEnd(); e.moveNext()) {
if (e.item().Status > 1) { online++; } else { offline++; }
}
MsgPlus.DisplayToastContact('Contact Counter', '[c=green]Online: ' + online + '[/c]\n[c=red]Offline: ' + offline + '[/c]', 'Next count in ' + TimeLength(mytime));
MsgPlus.AddTimer('reload', mytime) //Replace with SixtyMins if you want an hour
}
function OnEvent_Timer(sTimerId) {
if (Messenger.MyStatus != 0) {
OnEvent_SigninReady(Messenger.MyEmail);
}
}
Extremely important note:
Each and every script that uses timers to manipulate or check user specific stuff should first check if the same user is still signed in when the timer triggers!!!
It should check if it is still the same current user who is signed in and thus only perform the action if the user is the same as the one who started the timer.
Failing todo all this will cause many errors when:
- the user signs out when a timer is still active
- a new user signs in and the action when the timer triggers is something like blocking a contact, changing status, retrieving contacts, etc...
All this because
timers do not reset and aren't deleted when somebody signs out or when somebody else signs in.
For this particular script above, the check to see if it is still the current user who started the timer, isn't needed since the
SigninReady() event function is used, but every developer should be aware of the above pitfalls.
Extremely many scripts make these faults...
Another, and even better solution for the above problem (for this particular script!) is to explicitly delete the timer when the user signs out:
code:
function OnEvent_SignOut(sTimerId) {
MsgPlus.DeleteTimer('reload');
}
function OnEvent_Timer(sTimerId) {
OnEvent_SigninReady(Messenger.MyEmail);
}