Scripts running on only one account when polygamy is enabled? - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Scripts running on only one account when polygamy is enabled? (/showthread.php?tid=74828)
Scripts running on only one account when polygamy is enabled? by Macaroonny on 05-29-2007 at 03:52 PM
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 ), 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?
RE: Scripts running on only one account when polygamy is enabled? by CookieRevised on 05-29-2007 at 04:38 PM
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 ");
}
}
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)...
RE: Scripts running on only one account when polygamy is enabled? by Macaroonny on 05-29-2007 at 04:55 PM
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.
|