What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Saving Settings

Saving Settings
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: Saving Settings
That's why you may want to use OnEvent_Signout() as well ;)

When OnEvent_Signout occurs, you may set Initialised to false (following my example). When OnEvent_Signin (and therefore OnEvent_Initialize) is called, Initialised will be set to true, and LoadSettings is called (which then overwrites the previously loaded variables).

You may only declare a variable once (on "the global scope" or "outside functions"), but you can assign it as many values as you want ;)
Inside functions, however, you may use variable names more than once, as long as they're not declared in the same function.

Example:

code:
var myGlobalVar = "Gone global"; // Global scope: accessible throughout the script

function OnEvent_Initialize(bool) {
      var myVar = "Hello world"; // local scope: only in this function
      myGlobalVar = "WorldWideWeb"; // It's global, accessible everywhere
}

function OnEvent_Uninitialize(bool) {
      var myVar = "Goodbye world"; // local scope
      Debug.Trace(myGlobalVar); // Again: global scope so accessible throughout script
}


EDIT::

As a security measure, you can let LoadSettings check if Initialised is true:

code:
function LoadSettings() {
     if(Initialised) {
          //Load them now
     }
}

// an extra security measure could be
function LoadSettings() {
     if((Initialised) && (Messenger.MyStatus > 0)) {
          //Load them now
     }
}



This post was edited on 11-01-2008 at 06:45 PM by SmokingCookie.
11-01-2008 06:36 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Saving Settings - by ArkaneArkade on 11-01-2008 at 02:38 AM
RE: Saving Settings - by markee on 11-01-2008 at 04:00 AM
RE: Saving Settings - by ArkaneArkade on 11-01-2008 at 04:29 AM
RE: Saving Settings - by markee on 11-01-2008 at 04:58 AM
RE: Saving Settings - by SmokingCookie on 11-01-2008 at 02:27 PM
RE: Saving Settings - by ArkaneArkade on 11-01-2008 at 05:33 PM
RE: Saving Settings - by SmokingCookie on 11-01-2008 at 05:38 PM
RE: Saving Settings - by ArkaneArkade on 11-01-2008 at 05:43 PM
RE: Saving Settings - by SmokingCookie on 11-01-2008 at 05:49 PM
RE: RE: Saving Settings - by ArkaneArkade on 11-01-2008 at 05:55 PM
RE: Saving Settings - by SmokingCookie on 11-01-2008 at 06:01 PM
RE: RE: Saving Settings - by ArkaneArkade on 11-01-2008 at 06:31 PM
RE: Saving Settings - by ArkaneArkade on 11-01-2008 at 06:10 PM
RE: Saving Settings - by SmokingCookie on 11-01-2008 at 06:17 PM
RE: Saving Settings - by SmokingCookie on 11-01-2008 at 06:36 PM
RE: RE: Saving Settings - by ArkaneArkade on 11-01-2008 at 06:45 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On