Results 1 to 6 of 6

Thread: Option to not stop automation upon reaching a hobo boss?

  1. #1
    Senior Member
    Join Date
    Apr 2019
    Posts
    115

    Default Option to not stop automation upon reaching a hobo boss?

    I'm trying to make an afterAdventureScript that goes in burnbarrel boulevard (if at image 10) in hope of landing on the semi-rare.

    However, whenever mafia recognizes that you select the 2nd choice of a hobo boss non-combat, it displays a message and stops everything (even if selecting the choice with visit_url() !! ); could there be a way to disable this?

    Btw, I don't know what this is, but it didn't seem to match mafia's behaviour (even a print() right after handling the choice adventure was getting ignored).

  2. #2
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,515

    Default

    Code:
    		case 200:
    			// Enter The Hoboverlord
    		case 201:
    			// Home, Home in the Range
    		case 202:
    			// Bumpity Bump Bump
    		case 203:
    			// Deep Enough to Dive
    		case 204:
    			// Welcome To You!
    		case 205:
    			// Van, Damn
    
    			// Stop for Hobopolis bosses
    			if ( ChoiceManager.lastDecision == 2 && KoLmafia.isAdventuring() )
    			{
    				KoLmafia.updateDisplay( MafiaState.PENDING, ChoiceManager.hobopolisBossName( ChoiceManager.lastChoice ) + " waits for you." );
    			}
    			break;
    KoLmadfa.isAdventuring starts at false. KoLmafia.makeRequest does this:

    Code:
    					KoLmafia.isAdventuring = true;
    ...
    			KoLmafia.executeRequest( request, iterations, wasAdventuring );
    ,,,
    		finally
    		{
    			if ( request instanceof KoLAdventure && !wasAdventuring )
    			{
    ...
    				KoLmafia.isAdventuring = false;
    Which is to say, isAdventuring will only be true if you are actually automating. Your statement "stops everything (even if selecting the choice with visit_url() !! )" looks to be impossible, since visit_url() is not "automating" via KoLmafia.makeRequest.

    Now, the adventure command (or ASH function) will call KoLmafia.makeRequest.

    How, exactly, are you "go[ing] in burnbarrel boulevard"?
    You are doing it "in the hope of landing on the semi-rare".
    What does "hope" have to do with it? It's either the semirare counter or it is not. Shouldn't you know that?
    If you go there when the semirare is due, you will find choice #291 and option 1 will let you buy the semirare. If you go there when the boss is due, you will find choice #201 and option 2 should let you leave the fight.

    To be honest, I don't understand why it aborts automation when you intentionally choose to not fight the boss. Probably because if you are automating 100 turns in the zone, get the boss choice, and exit it, it SHOULD stop automating that zone.

    I see nothing in the code to make me think it will display the message (and abort automation) if you are NOT automating.

    Please show me the code you use to go to burnbarrel blvd and select option 1 for choice 291 and option 2 for choice 201.
    I assume you are using adv1 or adventure. Have you considered capturing the return value of that function?

  3. #3
    Senior Member
    Join Date
    Apr 2019
    Posts
    115

    Default

    How, exactly, are you "go[ing] in burnbarrel boulevard"?
    You are doing it "in the hope of landing on the semi-rare".
    What does "hope" have to do with it? It's either the semirare counter or it is not. Shouldn't you know that?
    Originally Posted by Veracity View Post
    I was putting my little script as an afterAdventureScript.
    Hope is just a word made by humans, just like luck, to group/categorize everything that has elements unknown to him. It was only "hope" because I didn't know which adventure (out of the ~80 possibilities) would give the semi-rare, even though I knew I was in the window.
    I was using visit_url("adventure.php?snarfblat=168"), because I thought it would be the method in which mafia would "interfere" the less.

    To be honest, I don't understand why it aborts automation when you intentionally choose to not fight the boss. Probably because if you are automating 100 turns in the zone, get the boss choice, and exit it, it SHOULD stop automating that zone.
    couldn't you just set choiceAdventure201 to "0" (show in browser)?


    (in this, "_fredg1_largeSemiRareWindow###" is set by another script in which I miss a semi-rare (community service))
    Code:
    if( get_property("semirareCounter").to_int() >= get_property("_fredg1_largeSemiRareWindowStart").to_int() )
    {	print("Already got Semi-Rare");	set_property("afterAdventureScript", "");	exit;}
    
    if( get_property("_fredg1_largeSemiRareWindowStart").to_int() <= my_turncount() && get_property("_fredg1_largeSemiRareWindowEnd").to_int() >= my_turncount() )
    {
    	if( get_property("_fredg1_lastBurnbarrelCheck")to_int() == my_turncount() || get_property("lastAdventure") == "Burnbarrel Blvd." )	exit;
    	
    	if( visit_url( "clan_hobopolis.php?place=4" ).contains_text( "burnbarrelblvd10.gif" ) )
    	{
    		visit_url( "adventure.php?snarfblat=168" );
    		
    		if( get_property("lastEncounter") == "Home, Home in the Range" )
    		{	visit_url("choice.php?pwd&whichchoice=201&option=2");	set_property("_fredg1_lastBurnbarrelCheck", my_turncount());}
    		else if( get_property("lastEncounter") == "A Tight Squeeze" )
    		{	run_choice(1);	set_property("afterAdventureScript", "");}
    	}
    }

  4. #4
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,515

    Default

    Oh. So you are automating, and your script is an afterAdventureScript. And you are poking burnbarrel after every adventure (elsewhere), just in case the semirare is now; you have not actually determined the semirare counter.

    Code:
    		while ( KoLmafia.permitsContinue() && ++currentIteration <= totalIterations )
    		{
    			...
    			KoLmafia.executeRequestOnce( request, currentIteration, totalIterations, items, creatables, wasAdventuring );
    executeRequestOnce invokes the afterAdventureScript. Which is to say, isAdventuring is true during the execution of the adterAdventureScript.

    visit_url("choice.php?pwd&whichchoice=201&option=2 ");

    could be

    run_choice(2);

    Regarding your automation, this is first example I've seen of an afterAdventureScript which can abort automation.
    Both visit_url and run_choice return a buffer, not a boolean "continueValue", which means that capturing the result will not prevent aborting.

    I'll have to think more about this.

  5. #5
    Senior Member
    Join Date
    Jun 2016
    Posts
    378

    Default

    I use this as part of my afterAdventureScript, which was running without problem last I used it (I haven't setup in a long aftercore for a while, so I haven't tested it in the last couple of months). One thing that might differ is that I empty out my afterAdventure script at the start of my script, to restore it at the end, to avoid nesting calls.

    Code:
    void SemiRare() {
    	location SemiRareLocation = SemiRareLocation();
    	if ( SemiRareLocation != $location[none] ) {
    		SaveSetup();
    		switchClan(hobopolisSemirareClan);
    		string romanticTarget = get_property("romanticTarget");
    		adv1(SemiRareLocation, -1, "");
    		if ( !($strings[home\, home in the range, van\, damn, deep enough to dive, bumpity bump, welcome to you!, flowers for you, cold comfort, juicy!, maybe it's a sexy snake!, a tight squeeze] 
    			contains stripLastEncounter() )
    			&& $locations[Burnbarrel Blvd., Exposure Esplanade, The Heap, The Ancient Hobo Burial Ground, The Purple Light District] contains to_location(get_property("lastAdventure")) )
    		{
    			abort("Unexpected adventure while fishing in hobopolis for semi-rares: "+get_property("lastEncounter"));
    		}
    		set_property("lastSemiRareCheck",total_turns_played());
    		switchClan(clan);
    	}
    }

  6. #6
    Senior Member Crowther's Avatar
    Join Date
    Nov 2006
    Posts
    1,529

    Default

    You can also end up "hoping" for a semirare when you eat a fortune cookie and multiple numbers look possible.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •