Stuck in Cage detection

mredge73

Member
I have used this little function for almost two years but mafia now aborts my script if I am stuck in the sewer when using it at the beginning of a breakfast script. All mafia breakfast options are disabled so my breakfast script does get executed but halts when this function is called. The purpose of the function is to detect if I am in the cage, if I am in the cage the bot will resume chat functionality and disable all other functions so not to hit the server. The bot should also get out if rescued so it has to periodically hit the "wait for rescue" button. When stuck I typically run this function over and over in 3-5 minute intervals until released and I use the unix timestamp to exit mafia right before rollover if not released.

I am looking for suggestions on improving/fixing it. The visit_url is just one that I picked at random, if in the cage then the normal text will be replaced with the choice adventure.

Code:
boolean StuckInSewer()
{
	string office= visit_url("clan_office.php");
	if( contains_text( office, "Despite All Your Rage"  ) && contains_text( office, "211"  ) )
	{
		set_property( "choiceAdventure211" , "2" );
		set_property( "choiceAdventure212" , "2" );
		run_choice(office);	
		set_property( "choiceAdventure211" , "0" );
		set_property( "choiceAdventure212" , "0" );
		office= visit_url("clan_office.php");
	}	
	
	if( contains_text( office , "Despite All Your Rage"  ) )	
		return true;
	else
		{
			if(contains_text( office , "Pop!"  ))
			{	
				set_property( "choiceAdventure296" , "1" );
				run_choice(office);	
				cli_execute("refresh all");
			}			
			set_property( "choiceAdventure211" , "0" );
			set_property( "choiceAdventure212" , "0" );
			return false;
		}
}
 

mredge73

Member
my bad,

manual control for choice 211
mini browser pops up and mafia aborts script
I am guessing it is awaiting input from the user.

Mafia change on Rev 8803 made this function obsolete, while I am glad that the choice is now supported I still need a method of detection so I can act in chat while stuck.
Now that it is supported I should be able to set the choice to "2" (wait for rescue) right? Will mafia respect that choice? Before this change, setting it to anything other than 0 caused all kind of weird issues.
On mafia's choice adventure panel, choice "2" is not on the drop down list. Does that mean it is not supported?
 
Last edited:

Bale

Minion
choice 2 is not in the drop-down because if you did that it would loop endlessly. That would be very not good.

To stay in the cage you need to not choose anything. That's why mafia did the right thing by aborting to manual control.
 

Theraze

Active member
Easiest way to make your script work is, if it detects that it's stuck... stop. Don't run choice. Just leave it stuck.
 

mredge73

Member
I tend to run choice to advance from choice 211 to 212 but I don't remember why I did that.
For some reason I didn't like choice 211 but I may not need to do that, I will need to do some more research.
 

mredge73

Member
Ok
So this is not going to work. I have to advance to choice 212. I have to hit the wait for rescue on Choice 211 or I will never be able to get out of the cage if I am rescued by another clannie.
I think that it would not hurt for mafia to support choice 211 since it will not loop repeatedly, it will advance to choice 212 immediately.
 

Theraze

Active member
Manually set 211 to the choice you want it to be... despite not having a dropdown, it should still pick the option you've set.
 

mredge73

Member
Will do
Is there a way to set 212 to 2 and have it only try once instead of looping endlessly?
This is my current project, I am trying to build a work around but am running out of ideas.
 

Theraze

Active member
Only by doing manual visit_urls and detecting/sending the choice. Can't do it with automatic handling...

It's like the Spooky Forest, but so much worse.
 

mredge73

Member
That is what my original script did.
But now that it is supported, it aborts the script before I get a chance to do manual visit_urls

For some reason the original script will still work if restarted manually after logon.
It will crash (manual control for choice 211) if it is used as a breakfast script.

Edit:
I may be incorrect here, I may also need to issue a bug report. I have to do some more testing.
If stuck in the cage, issuing : cli_execute("chat"); will also crash the script. I do this right before this function is called. Weird.
 
Last edited:
Top