Problem with logout script

Winterbay

Active member
I'm currently trying to use the following as a logout script:

PHP:
# Logout script for Molman and Winterbay
if(my_name() == "molman") {
	int closet_meat = my_meat() - 100000;
	if(closet_meat > 0) {
		put_closet(closet_meat);
	}
	else
	{
		closet_meat = 0;
	}
	print("Closeted " + to_string(closet_meat) + " meat. Quitting");
}
else if(my_name() == "winterbay") {
	print("Changing account to Molman");
	cli_execute("login molman");
}

Molman is my farming multi and Winterbay is my main account. I start the day by logging in to Winterbay and play those turns and then to Molman to automate some farming. With this in mind I thought that I should get the script to login Molman if Winterbay was logged in and closet any meat over 100k for Molman when that is logged out (to stop me from accidentally buying something I do not want to buy).

The problem is that when mafia logs Molman in it is with the current state of Winterbay and with no items at all. Is there a way to avoid this?
 

Winterbay

Active member
Hmm... Tried that, but it did not appear to work. The dauly deeds still show the Styx-alternatives, the familiar list is empty and I can't start the relay browser. Logging back out and in the "normal way" solves the issue.
 

Grotfang

Developer
Could mafia be logging molman in before logging winterbay out? Maybe that's a silly/pointless question, but I imagine that could produce odd behaviour.
 

Bale

Minion
The login command will immediately perform a log out before doing a log in.

It's pretty weird to log out in the middle of a logout script. It's equally weird to finish logging in before finishing a logout script. There could be more commands after that login command so what would happen to them?

The whole concept of logging in during a logout script is begging to create bugs. I'd suggest you scrap this.
 
Top