What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Scripts running on only one account when polygamy is enabled?

Scripts running on only one account when polygamy is enabled?
Author: Message:
Macaroonny
New Member
*


Posts: 2
Joined: May 2007
O.P. Scripts running on only one account when polygamy is enabled?
This may well have been asked before, but when you have multiple accounts logged on, can you have a script only enabled for one of them?
I'm asking because I've written myself an AI script that collects requests for an internet radio station, as well as maintaining simple conversation. It reads the message sent to it, responds appropriately (most of the time :P), then closes the window so as not to get in the way of the DJ. When a request is sent, the request is placed into a .txt document and saved elsewhere.
I'd like to have the bot running parallel to my own account, without the AI script interfering with my own conversations. Is this already possible, or could a script be written to do this?
05-29-2007 03:52 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Scripts running on only one account when polygamy is enabled?
First of all 'polygamy' (the word used to indicate "multiple messenger instances") means that you can log in with two or more accounts at the same time. Where each account has its own Messenger program.

So, you can't log in with two or more accounts into the same Messenger program. You need multiple Messenger programs to be running.

Then, you can't log in with the same account into two or more Messenger programs at the same time. You do need different accounts.

All this said, scripts run on every Messenger program. And disabling them in Plus!'s preferences for one account but enabling them for the other is not a good thing todo, as this wont work properly.

However, what you can do is programming the script in such a way that it will only react on stuff if the logged in user is X (in your case the bot) and not anybody else.

For this you need to check Messenger.MyEmail against the account email you whish the script to be 'running' with (it actually will run for the others too of course, but it wont do anything).

This check needs to be placed in each and every function your script has. Or you can use a global variable, etc...

in pseudo-code:
code:
// Make global variable
var bEnabled;

function OnEvent_SignIn(Email) {
    // Set boolean value according to the signed in user
    bEnabled = (Email === "mybot@mail.com")
}

function DoSomething {
    // Only do something if the signed in user is our bot
    if (bEnabled) {
        var Something = 1 + 1;
        Debug.Trace("I'm doing something :p");
    }
}

function DoSomethingElse {
    // Only do something if the signed in user is our bot
    if (bEnabled) {
        var Something = 2 * 2;
        Debug.Trace("I'm doing something else.");
    }
}
Of course this is extremely simplyfied. In a big script you need to take in account many other things too, like the possebility that another user can sign in, that scripts start to run before a user has signed in and continues to run if a user signs out. (All extremely important to take in account when using timers for example)...

This post was edited on 05-29-2007 at 04:43 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-29-2007 04:38 PM
Profile PM Find Quote Report
Macaroonny
New Member
*


Posts: 2
Joined: May 2007
O.P. RE: Scripts running on only one account when polygamy is enabled?
Ah, good idea! I hadn't thought of that. I realised there might be some risks to enabling a script in one account, and disabling it on another, which is why I came here.
05-29-2007 04:55 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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