quote:
Originally posted by stu
lol, ok, so lets see if I get this right.. I should remove code:
arrLyrics = GetAllLyrics();
from my personalMessage function, but add it in where the script is first initialized from..
yes
quote:
Originally posted by stu
So that should be put in OnEvent_Signin(Email), and OnEvent_Initialize(MessengerStart).
Edit: I think I would need to add it to the toggle function, that switches between on and off, as well
Actually, you only need to add it once. Best to do this in the 'toggle' function.
The OnEvent_Signin() and OnEvent_Initialize() just need to point to the toggle function also. Because I suspect you currently have the same code in those functions also....
This is again optimizing code in a logic way, splitting things up, instead of putting many same code all over the place.
eg:
code:
function OnEvent_Initialize() {
if (Messenger.MyStatus > 0) OnEvent_Signin();
}
function OnEvent_Signin() {
GetUserSettings()
}
function OnEvent_SignOut() {
SaveUserSettings();
Toggle(false);
}
function GetUserSettings() {
<read the user settings from the registry here, eg: should the stuff be enabled or not (= boolean value bEnabled below)>
Toggle(bEnable);
}
function SaveUserSettings() {
<write the user settings to the registry here>
}
function Toggle(bEnable) {
if (bEnable) {
arrLyrics = GetAllLyrics();
<do some other stuff here, like starting timers or whatever>
} else {
<disable timers, etc>
}
}
function personalMessage() {
<...>
}
something like that...
In that way you only need to change stuff in one place.
quote:
Originally posted by stu
(Little bit off topic: I have copied most of this stuff from Toast Message, as it had a menu similiar to what I wanted, and then I tweaked it for myself. It has both of those functions doing the same thing, what exactly is the difference of them both, and do I really need both of them?)
You only need one of the two. The difference is only in what window it uses to get to the contactlist.