macguffin.ash (a script in progress)

StormCrow42

Member
Love this script, just have a few comments and one strange behavior.

First, it would seem to make better sense to unlock the oasis before opening up the hidden city. That way you burn off the negative oasis effects in the hidden temple.

Second, the hidden temple script (the latest one posted near the end of the thread) seems to only restore HP and not MP between adventures, leading to running out of MP for spell slinging classes.

Third, I've encountered the strangest behavior in the hidden city script which pops up a prompt for a "value" twice per square adventured in. It continues onward no matter what I enter however.

(I'm using the hardcore recovery script posted elsewhere on these forums if it's possible that it's causing some of these interactions)
 

zarqon

Well-known member
Okay, here's my current versions of these scripts again (I'm going with my rewrite being 2.0, this update is 2.0.1). I guess I'll just keep posting them here. For future reference, if in doubt, just grab the most recent (from the end of the thread).

@Stormcrow: 1) great idea! Done. 2) I guess the restore script only restores HP? I didn't have time to play with it. Possible fix: switching lines 123 and 124 of the hidden city script. If anyone tries it, let me know if it works.

3) I guess the restore script requires parameters? I believe a lot of people are using that script so I would like this script to play nice with that one. Right now I'm basically just doing this:

Code:
if (get_property("recoveryScript") != "") cli_execute("call "+get_property("recoveryScript"));

If the restore script requires parameters for main() this would cause the behavior you described, and could be fixed fairly easily. Bale? Care to chime in?

For now, fixes include:
  • moving hidden city reveal after pyramid reveal (which has the added benefit of removing "negative effects removal" from my to-do list)
  • some continuity errors if the script is stopped at certain points
  • not trying to equip the fledges if you already have them equipped (duh)
 
Last edited:

Bale

Minion
If the restore script requires parameters for main() this would cause the behavior you described, and could be fixed fairly easily. Bale? Care to chime in?

I'm not actually using your script, but I'll try to answer your questions. Restore scripts do require parameters, but you don't ever need to care about that since mafia will call the script for you. Just do restore_mp(0) or restore_hp(0) and mafia will know if a restore script is being used.

In other words, you can turn this:

Code:
      if (get_property("recoveryScript") == "") {
         restore_hp(0);
         restore_mp(0);
      } else cli_execute("call "+get_property("recoveryScript"));

into this:
Code:
         restore_hp(0);
         restore_mp(0);
 
Last edited:

zarqon

Well-known member
Thanks be to Bale, our resident restore script expert.

Here's the fixed version, as well as removing some choiceAdv settings due to the recent KoL trivial update.
 

Attachments

  • macguffin.ash
    11.9 KB · Views: 59
  • hiddencity.ash
    7.8 KB · Views: 59

bouzdreaux

New member
Super script; thanks izchak, zargon, et al.

However, it is getting stuck at the manor because the ballroom has not been unlocked. Can anyone advise on inserting code to unlock ballroom?

Update: I now have a workaround, but it doesn't exactly fit nicely into your script...

And another update: The script also halts if there are no spectacles in inventory. To remedy this, I inserted the second if statement below in the manor_of_spooking() function...

if (!contains_text(questlog,"secret black magic laboratory"))
{
if( item_amount($item[Lord Spookyraven's spectacles]) < 1 )
obtain(1, "Lord Spookyraven's spectacles", $location[Haunted bedroom]);
 
Last edited:

zarqon

Well-known member
I too would be curious to know if there is a simple way to get the ballroom key from the bedroom. Can you just set it as a condition, and mafia auto-completes the two choiceadvs? That would be nice.

What workaround did you come up with, bouzdreaux?

A player who has been playing optimally will already have done the Spookyraven stuff, including the ballroom key, by the time the level 11 quest comes along. We could perhaps also include code for unlocking the second floor in case that hasn't been done yet, and unlocking the library if that hasn't been done yet, and unlocking the F'c'le, or even getting the swashbuckling outfit... how far back is too far?
 

Bale

Minion
Well, I always unlock the second floor and open the ballroom as soon as I can survive the ballroom, in order to get the -combat song. For that reason, I'd say that it is way too far back, but for less optimal players it isn't surprising if they've completely forgotten about Spooky Raven altogether until the maguffin quest comes along. Some players can really be quite lax about setting up for the Maguffin and then they complain that it is too much all at once without any choices. :rolleyes:

Incidently, for the second floor unlock, I've got this sitting around. I seem to remember that it was originally posted by holatuwol. You'd probably want to modify it to only open the gallery for muscle classes and of course it now it takes more than 1 adventure to find the key, so perhaps you'd want to leave that part off altogether.

Code:
void main()
{
	// Default for Library 1: unlock the second floor

	set_property( "choiceAdventure80", "99" );

	// Default for Library 2: unlock the gallery quest

	set_property( "choiceAdventure81", "1" );
	set_property( "choiceAdventure87", "2" );

	// We search for a choice adventure to advance.

	cli_execute( "conditions add 1 choiceadv" );
	adventure( my_adventures(), $location[haunted library] );

	// Rather than incrementally doing things (retrieve towel,
	// come back, or unlock gallery, then come back), we do it
	// all at once to save logic.

	// A person manually adventuring in the browser will return
	// to the map no matter what, either to unlock the gallery
	// or to advance to the second floor.

	// So, if KoLmafia returns to the map to figure out what to
	// do next, it's perfectly reasonable. :)  We figure out if
	// we hit the stair choice by seeing if manor2 is available.

	if ( visit_url( "manor.php" ).contains_text( "manor2.php" ) )
	{
		// Ignore the rise of spookyraven adventure

		set_property( "choiceAdventure80", "4" );

		// The gallery unlock adventure is an auto-stop adventure,
		// so we don't need to use conditions before KoLmafia stops
		// automatically when it sees it.

		adventure( my_adventures(), $location[haunted library] );
	}
	else
	{
		// We have two options.  Ignore the spookyraven adventure,
		// or use it to unlock the staircase.  Obviously, one is
		// more efficient than the other.

		set_property( "choiceAdventure81", "99" );

		// Now, as long as we hit a choice adventure, KoLmafia will
		// unlock the second floor stairs.  So we go do it.

		cli_execute( "conditions add 1 choiceadv" );
		adventure( my_adventures(), $location[haunted library] );
	}

	// Retrieve the gallery key from the conservatory

	adventure( 1, $location[haunted conservatory] );
}
 
Last edited:

tOaDeR

Member
most of this script works fine for me except for the Pyramid. once i get that far, i get this message in the gCLI:

> call scripts/macguffin.ash

Black market found.
Diary obtained.
Hidden city revealed.
Oasis revealed.
Cellar revealed.
Palindome revealed.
Macguffin quest started.
Hidden city complete.
Pyramid revealed.
Dr. Awkward defeated.
Lord Spookyraven defeated.
Verifying ingredients for Staff of Ed (1)...
Verifying ingredients for headpiece of the Staff of Ed (1)...
Creating headpiece of the Staff of Ed (1)...
You acquire an item: headpiece of the Staff of Ed
Successfully created headpiece of the Staff of Ed (1)
Creating Staff of Ed (1)...
You acquire an item: Staff of Ed
Successfully created Staff of Ed (1)
You can't wear that outfit.
Unable to reveal Ed's chamber.

what oufit does it mean?
 

zarqon

Well-known member
I had a similar issue previously where after creating the Staff of Ed, retrieve_item(1, $item[staff of ed]) was returning false. In fact, any call to retrieve_item() that attempted to get an amount you already had in inventory returned false. After closing mafia and starting a new session, the problem was gone. Weird.

But that's not what you asked. Ha.

The outfit in question is called "current". I mentioned above that I had completely removed outfit handling from this script; the only thing the script does is try to wear "current" before adventuring anywhere.

I suppose the nice thing to do would be to at least put that in a variable at the top, so you could easily change its name if you like. That's something I can do when I get back from Singapore.
 

tOaDeR

Member
now that we've got the outfit question out of the way, why is it "Unable to reveal Ed's chamber." ?
 

zarqon

Well-known member
@tOaDeR: Does the Staff of Ed show up when you type "inv staff" in the CLI?

@all: This version has a few minor fixes, including the aforementioned outfit variable.
 

Attachments

  • macguffin.ash
    12.1 KB · Views: 113
  • hiddencity.ash
    7.9 KB · Views: 109

tOaDeR

Member
i downloaded the new version and i get this:

> call scripts/macguffin.ash

Black market found.
Diary obtained.
Oasis revealed.
Hidden city revealed.
Cellar revealed.
Palindome revealed.
Macguffin quest started.
Hidden city complete.
Pyramid revealed.
Dr. Awkward defeated.
Lord Spookyraven defeated.
You can't wear that outfit.
Unable to reveal Ed's chamber.

> inv staff

chrome staff
linoleum staff
meatspout staff
Staff of Blood and Pudding
Staff of Ed
Staff of the Grand Flambé
Staff of the Grease Trap
Staff of the Kitchen Floor
Staff of the Teapot Tempest
Staff of the Walk-In Freezer
Staff of the Well-Tempered Cauldron

what am i missing?
 
Last edited:

zarqon

Well-known member
This may be a mafia bug. What happens when you type this into the CLI?

ash retrieve_item(1,$item[staff of ed]);
 

twentythree

New member
> call scripts/macguffin.ash

Sending kmail to Zarqon...
Black market found.
Diary obtained.
Oasis revealed.
Hidden city revealed.
Cellar revealed.
Palindome revealed.
Macguffin quest started.
Hidden city complete.
Pyramid revealed.
Dr. Awkward defeated.
Lord Spookyraven defeated.
Unable to reveal Ed's chamber.

> inv staff

Staff of Ed

> ash retrieve_item(1,$item[staff of ed]);

Returned: false
 

zarqon

Well-known member
This has happened to me several times as well. Somehow, after this happens, trying to retrieve_item() any item you already have will return false. I don't know why it happens, but I know that restarting mafia will solve the problem. Just refreshing inventory will not solve it since as you have seen, mafia does have your inventory correctly.

I'll submit a bug report, although I'm not altogether certain what exactly is causing the bug.
 

dangerpin

Member
It looks like loading the macguffin.ash fails as it runs into an error with hidden city.ash on line 170

Code:
if (i = 30) return false;

I assume the problem is because of the most recent changes where "=" should be changed to "==", I did this and it allowed me to continue.
 

Raven434

Member
Working on quest step Macguffin.
Resetting mind control device...
Mind control device reset.
Black market found.
Diary obtained.
Oasis revealed.
Hidden city revealed.
Cellar revealed.
Palindome revealed.
Macguffin quest started.
Hidden city complete.
Pyramid revealed.
Dr. Awkward defeated.
Lord Spookyraven defeated.
Unable to reveal Ed's chamber.

I have restarted Mafia and it doesn't help.

I looked at line 170, to make sure it is using '==' instead of '=' and it is.

Not sure how to proceed




> inv staff

chrome staff
linoleum staff (2)
meatspout staff
Staff of Ed

> ash retrieve_item(1,$item[staff of ed]);

Returned: false
 
Last edited:

Veracity

Developer
Staff member
I see that retrieve_item was not returning what InventoryManager.retrieveItem returns - which is a simple boolean, true or false, depending onwhether it could get the item yo requested, but instead was returning KoLmafia's "continuation state".

That doesn't seem right. Revision 7229 fixes that.
 
Top