MacGuffin 2.0 -- level 11 quest, automated

zarqon

Well-known member
[size=+1]MacGuffin 2.1.1[/size]

NOTE: This script is dead. A script that begins with O has taken over its job and does a much better job of it, to boot.

This is my revamp of the original MacGuffin script by izchak et. al. I am moving it here to its own thread so that it is easy to find, discuss, and debug, separate from the original script, which is no longer supported or developed by the OP.

This script will complete the entire MacGuffin quest for you, but it assumes a few things:

  • You have already opened the F'c'le.
  • You have already revealed the second floor of Spookyraven Manor.
  • You have a great outfit specified as your "defaultoutfit" that you pretty much want to use for all your adventuring. (see below)

If all of these are true, the script should run just dandily for you, as it has for me quite a few times now.

There are just a few ZLib settings you can configure (for each character), either by typing "zlib vars" in the CLI, or by editing myname_vars.txt in your data directory:

  • macguffin_buyratchets -- if true, will attempt to purchase tomb ratchets to turn the pyramid quickly. If false (default), will instead use whatever tomb ratchets you have, but then adventure to turn the wheel by the regular method.
  • macguffin_fightbosses -- this variable specifies whether or not you want to include boss fights in the script. If false (default), the script will abort when it's time for you to go fight either Dr. Awkward or Lord Spook.
  • Also note that this will make use of the outfit you have specified in defaultoutfit.

Acknowledgments
Thanks to izchak and the others who contributed to the original script's development. Thanks to all those who have helped iron out the bugs in this one.

How to use it:
  • Download macguffin.ash to your scripts directory.
  • Also, get ZLib if you haven't already.
  • This script currently doesn't do anything special against spirits/specters in the Hidden City, so you may want to change your CCS. At the moment, I recommend adding [ protector ] 1: abort to your CCS.
  • Run the script from within mafia (either from the scripts menu, or by typing "macguffin").
  • Get a MacGuffin! (NOTE: This script does not fight Ed. You should fight him personally, yourself, since he is awesome.)

Changelog
5.20.09 - ver. 2.0.4 posted in this new thread.
5.30.09 - ver. 2.0.5 changes: don't depend on the results of use() when using tomb ratchets.
6.14.09 - ver. 2.0.6 changes: moved some functions out -- now requires ZLib.
8.03.09 - ver. 2.0.7 changes: use ZLib's recent "defaultoutfit" setting. Fix already-completed-quest detection. Reveal hidden temple before revealing the city if for some bizarre reason you hadn't yet done that. Add very basic handling of revealing ballroom in case you haven't yet (doesn't set choiceadvs). Include kain's fix for avoiding the blank page issue in the pyramid quest.
12.06.09 - ver. 2.0.8 changes: entirely new hidden city logic replaces outdated hiddencity.ash. Ensure that dusty bottles are identified. Fixed issue with obtaining and equipping spectacles.
12.30.09 - ver. 2.0.9 changes: convert to ZLib's new vprint().
11.14.10 - ver. 2.1 changes: Make sure to actually engage the final spectre in combat. Initial attempt at supporting KoL changes to Mr. Alarm. Convert script variables to ZLib settings.
 

Attachments

Last edited:
Is this the script that is included in dj_d's Ascend.ash? The one included keeps trying to get the diary even though I've already done all the subquests and just need to get the pyramid unlocked, and ultimately fight Ed.

EDIT: Level 14 normalcore (out of ronin) sauceror. Blame ascend.ash for the guffining at level 14, but I've already done the War so it's okay.
 
@MM: I'm not sure if it's the same version or not - Z? Because of the way levelup.ash works, ascend.ash is slower to ascend myst classes. It plays them very conservatively, so I'm usually midway through level 13 or even on 14 by the time I ascend.
 
MapleMario: your problem sounds like mafia failing to detect your quest items, a bug which has been fixed in recent builds. Try it on the latest build of mafia.

dj_d: I'm not sure which version you bundled with Ascend.ash, but unless you bundled it recently, this has a few (very small, almost insignificant) improvements. I am now doing version checking on this script as of this thread, so you may want to re-bundle so that your Ascend users can know that they have the latest and greatest.
 
Thanks for the tips/info, but maybe this was a good thing - it forced me to do the macguffin by hand! Y'know, since I haven't done that since almost 10 ascensions ago (on different accounts, but still...) I was beginning to forget. :P

EDIT: FNORD (23rd post)
 
Running this version, with dj_d's ascend script I keep having it stop in the pyramid step with the "unable to reveal Ed's chamber" message after this point

Code:
[1144] The Middle Chamber
Encounter: Wheel in the Pyramid, Keep on Turning

Conditions satisfied after 3 adventures.
Step 1 / 3: get a token.
Current pyramid position: 2. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Unable to reveal Ed's chamber.

Restarting it does not help , but logging off mafia and restarting works as does running the earlier version of this script.

Looking at the differences between this one and the one bundled with ascend it seems to have been refactored somewhat in this area but I can't identify anything that would cause this problem.

Ascend version

Code:
  if (item_amount($item[ancient bronze token]) == 0 && item_amount($item[ancient bomb]) == 0) {
      print("Step 1 / 3: get a token.","blue");
      while (get_property("pyramidPosition") != "4") turn_once();
      adventure(1,$location[lower chambers]);
   }
   if (item_amount($item[ancient bronze token]) > 0 && item_amount($item[ancient bomb]) == 0) {
      print("Step 2 / 3: exchange token for a bomb.","blue");
      while (get_property("pyramidPosition") != "3") turn_once();
      adventure(1,$location[lower chambers]);
   }
   if (item_amount($item[ancient bomb]) > 0) {
      print("Step 3 / 3: reveal Ed's chamber.","blue");
      while (get_property("pyramidPosition") != "1") turn_once();
      adventure(1,$location[lower chambers]);
      print("Ed's chamber revealed.");
   }
   if (my_adventures() < 7) abort("You need at least 7 adventures to fight Ed.");
   return true;


this version

Code:
 boolean pyrstep(string stepname,string posnum) {
      print(stepname,"blue");
      while (get_property("pyramidPosition") != posnum) {
         if (my_adventures() == 0 || !turn_once()) return false;
      }
      return adventure(1,$location[lower chambers]);
   }
   if (item_amount($item[ancient bronze token]) == 0 && item_amount($item[ancient bomb]) == 0 &&
       !pyrstep("Step 1 / 3: get a token.","4")) return false;
   if (item_amount($item[ancient bronze token]) > 0 && item_amount($item[ancient bomb]) == 0 &&
       !pyrstep("Step 2 / 3: exchange token for a bomb.","3")) return false;
   if (item_amount($item[ancient bomb]) > 0) {
      if (!pyrstep("Step 3 / 3: reveal Ed's chamber.","1")) return false;
      print("Ed's chamber revealed.");
   }
   if (my_adventures() < 7) abort("You need at least 7 adventures to fight Ed.");
   return true;
 
Last edited:
I bundled it before this thread started, so it's not versioned. I'll wait until tebee's issue gets sorted out and update it.
 
@tebee: I trust you tried this using a recent build of mafia.

I have not been able to duplicate this problem on the last 7 runs, on multiple characters, both HC and SC, XP and Linux, always running the latest daily builds. If it is going to be fixed, it looks like it probably won't be by me.
 
Did you know that it does not break for cookie counters? Not sure, but I think the old script did. Would it be possible to put a cookie break back in?

edit: Also, after buying the dusty bottles, it says 'You ran out of restores. Unable to complete the Spookyraven section of the Macguffin quest.' What restores is it talking about? I have plenty of the ones I have checked.
 
Last edited:
I use a Fortune Cookie Counterscript to handle the cookie counters while running this or one click woosman. It will work everywhere except for the hidden city.
 
OK I put a little debugging code in to try and trace the problems I was having.

I changed the function turn_once as follows

Code:
boolean turn_once() {
      print("Current pyramid position: "+get_property("pyramidPosition")+".  Turning...","olive");
      if (buyratchets && retrieve_item(1,$item[tomb ratchet])) {}
      if (item_amount($item[tomb ratchet]) > 0) 
	  {
	  boolean tempbool = false;
	  tempbool = use(1,$item[tomb ratchet]);
	  print("Current tempbool =" +tempbool,"blue");
	  return tempbool;
	  }

when I ran the updated script I got

Code:
[1632] The Middle Chamber
Encounter: Wheel in the Pyramid, Keep on Turning

Conditions satisfied after 1 adventures.
Step 1 / 3: get a token.
Current pyramid position: 2. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Current tempbool =false
Unable to reveal Ed's chamber.

what I don't understand is why the "use(1,$item[tomb ratchet]) 2 is returning false

to confuse things further when I re-ran the script I got

Code:
Step 1 / 3: get a token.
Current pyramid position: 3. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Current tempbool =false
Unable to reveal Ed's chamber.

but when I re-ran it again I got

Code:
Step 1 / 3: get a token.

Visit to Pyramid: The Lower Chambers in progress...
Encounter: ancient bronze token
You acquire an item: ancient bronze token

Step 2 / 3: exchange token for a bomb.
Current pyramid position: 4. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Current tempbool =true
Current pyramid position: 5. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Current tempbool =true
Current pyramid position: 1. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Current tempbool =true
Current pyramid position: 2. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Current tempbool =true

Visit to Pyramid: The Lower Chambers in progress...
Encounter: ancient bomb
You acquire an item: ancient bomb

Step 3 / 3: reveal Ed's chamber.
Current pyramid position: 3. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Current tempbool =true
Current pyramid position: 4. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Current tempbool =true
Current pyramid position: 5. Turning...
Using 1 tomb ratchet...
Finished using 1 tomb ratchet.
Current tempbool =true

Visit to Pyramid: The Lower Chambers in progress...
Encounter: The Ancient Buried Pyramid

Ed's chamber revealed.
Go fight Ed to complete the quest! Or die, depending.
 
The return value for use() is unreliable and basically useless in scripting. It often returns false when you successfully use an item. Mafia does handle the advancement of the pyramid position when you successfully use a ratchet, however.
 
I had a devil of a time debugging a script before I realized that I could not count on use(), use_skill(), buy() or similar functions returning a value of any utility whatsoever. I consider that to be a serious flaw in ash. Either make the functions type void or have them return a boolean with some usefulness. As they exist they sucker you into making the error of believing their returned boolean has value.

Bah.
 
AH! I see the problem , if use returns an unreliable value , the turn_once will as well.

The original version of the code, that I posted on the previous page, ignored that return value, but the new version uses it in this line

if (my_adventures() == 0 || !turn_once()) return false;

Besides fixing the use command , what do you think is the best way to avoid this problem?
 
Like this:

Code:
boolean turn_once() {
      string first_position: get_property("pyramidPosition");
      print("Current pyramid position: "+first_position+".  Turning...","olive");
      if (buyratchets)
            retrieve_item(1,$item[tomb ratchet]);
      if (item_amount($item[tomb ratchet]) > 0) 
	  {
	  use(1,$item[tomb ratchet]);
	  return first_position != get_property("pyramidPosition");
	  }
      return false;
}

By the way, why do you use the rather unintuitive if (buyratchets && retrieve_item(1,$item[tomb ratchet])) {} instead of a more typical if (buyratchets) retrieve_item(1,$item[tomb ratchet]); ? Is there some advantage to the construction that I'm missing?
 
Last edited:
Yes, it captures the result of retrieve_item() so that if it fails it will not abort the script.

Does turn_once() actually return the result of use()?? If so, glaring blunder on my part.

EDIT: Now that I've had a chance to check it out I see that yes, I made the error of using the return value of use()! Oops -- will fix this when I get home. Should solve the problem, too, which is nice!

EDIT 3: turn_once() function updated in 2.0.5.
 
Last edited:
this is working much better, thank you. and now i know why i was getting any new replies in my email for this script.
 
OK... if you reported this bug to me, I'd tell you it was a KOL problem, not a mafia problem, and definitely not a script problem.

But here I am.

On two consecutive runs, I've manually aborted the pyramid quest (for random reasons both times). In both cases, when I immediately re-ran it, I got the dread message
"server wwwX.kingdomofloathing.com returned a blank page from beach.php. Complain to Jick..."
But here's the deal. Besides the suspicious timing, the message repros no matter which server I'm logged in to, but does not repro in the relay browser. I can even use mafia to adventure there. It's only the script that pukes.

Suggestions? I freaking hate doing this adventure manually. :)
 
Back
Top