Dungeon of Doom script

Pazleysox

Member
I'm working on a script that can get the ZAP Wand for you.

I know that choice Adventure 3 is the one to pay the Oracle. After you pay the Oracle, the + Plus sign becomes useable. I'm pretty sure Mafia will auto use it once it's able (This is incorrect come to find out)

I'm trying to put in a check to see if a choice adventure has been run. I looked at the wiki, and I think I see a way...

Question: How do I un-equip an item, or re-equip a previous item?
 
Last edited:

AlbinoRhino

Active member
1.
get_property("lastPlusSignUnlock") == my_ascensions()


2.
item prev = equipped_item($slot[SLOTNAME]);
equip($slot[SLOTNAME], $item[none]):
...
equip($slot[SLOTNAME], prev):
 

Pazleysox

Member
This is harder than I thought...

Trying to figure out how to run 1 adventure, then do a check.

Heres my script so far.
PHP:
void DOD()
{
	if (my_meat() < 5000)
	{
	print("You need atleast 5000 meat to finish this quest.");
	}
	set_property("choiceAdventure25", 2); // Pay 5k to buy cloak
	add_item_condition (0, $item[dead mimic]);
	adventure(my_adventures(), $location[Dungeons of Doom]);
	if ($item[dead mimic].available_amount() == 1)
	{
	print("Congrats, You've got a dead mimic!  Now use it, and Zap stuff!");
	exit;}
	if ($item[dead mimic].available_amount() == 0)
	{
	DOD();
	}
}

void EGTS()
	{

string dungeon = visit_url("da.php");
	if (dungeon.contains_text("The Dungeons of Doom"))
		{
		DOD();
		}
int count;
	set_property("choiceAdventure3", 3); // Pay 1k to oracle
	if ($item[plus sign].available_amount() == 0)
		{
		set_property("choiceAdventure451", 3); // Get + Plus Sign
		add_item_condition (1, $item[plus sign]);
		}
	if ($item[plus sign].available_amount() == 1)
		{
		cli_execute("use plus sign");
		set_property("choiceAdventure451", 5); // Get teleportitis
		}
	if(can_interact() && my_meat() > 100000 && $item[ring of teleportation].available_amount() == 0) // only buy if you have 100k meat or more
		{
		cli_execute("buy ring of teleportation");
		item prev = equipped_item($slot[acc1]);
		equip($slot[acc1], $item[ring of teleportation]);
		}
	if ($item[potion of teleportitis].available_amount() == 0 && $item[ring of teleportation].available_amount() == 0 && have_effect($effect[teleportitis]) == 0)
		{
		cli_execute("buy potion of teleportitis"); // on the chance we already know what the ! potions are...
		cli_execute("use potion of teleportitis");
		}
	if ($item[potion of teleportitis].available_amount() >= 1 && $item[ring of teleportation].available_amount() == 0 && have_effect($effect[teleportitis]) == 0) 
		{
		cli_execute("use potion of teleportitis");
		}
	adventure(my_adventures(), $location[The Enormous Greater-Than Sign]);
		EGTS();
	}

void main()
{
//Zap wand Script
	if (my_meat() <= 5999)
	{
	print("You need 6000 meat or more to complete this part of the quest.  Please gain some meat and try again");
	exit;
	}
string dungeon = visit_url("da.php");
	if (dungeon.contains_text("The Enormous Greater-Than Sign"))
		{
		EGTS();
		}
	if (dungeon.contains_text("The Dungeons of Doom"))
		{
		DOD();
		}
}
 
Last edited:

Pazleysox

Member
http://wiki.kolmafia.us/index.php?title=Adventure
adventure(1, $location[LOCATION NAME]);

or

http://wiki.kolmafia.us/index.php?title=Adv1
adv1($location[LOCATION NAME], -1, "");


Do a check for what? The plus sign being used? See my last post.

Sorry, I meant, run 1 turn, check for a plus sign in inventory, run another turn, check for plus sign, etc. I posted the script that I've written so far.

Here's a snippet of what I'm essentially trying to do:
PHP:
void EGTS()
 if($item[plus sign].available_amount > 0)
   { (get teleportitis/use plus sign) }
	adventure(1, $location[The Enormous Greater-Than Sign]);
		EGTS(); // loop back around to see if I have plus sign yet.  If not, run another adventure.
	}

Mafia only runs 1 turn though, then aborts saying conditions not met...
 

AlbinoRhino

Active member
Can't you use a goal, as you did with the dead mimic?

i.e. add_item_condition (1, $item[plus sign]);

​Then just adventure until you get it?

PHP:
add_item_condition (1, $item[plus sign]);
adventure(my_adventures(), $location[The Enormous Greater Than Sign]);

if (item_amount($item[plus sign]) > 0)
{
   ....
}
 
Last edited:

ckb

Minion
Staff member
Also, you can run adventures in while loops.

PHP:
while (item_amount($item[plus sign])==0) {
   adventure(1, $location[The Enormous Greater Than Sign]);
}
 

Pazleysox

Member
Is there a way to set a condition of getting a non-combat? I need to make sure the script sees the oracle before it can use the plus sign.

I did find this page about run_choice, but I don't fully understand it. I tried to use it, but it didn't work like I thought.

Code:
int run_adv(location place)

should (location place) be (location "Enormous Greater Than Sign") with "", or without?
or should it be run_adv((Enormous Greater...) without location?

Sorry if i'm asking too many questions. I learn best this way. I try to bull my way through things, lol.
 
Last edited:

AlbinoRhino

Active member
"location place" Refers to data of the mafia $location[] ( http://wiki.kolmafia.us/index.php?title=Data_Types ) data type, which is named 'place'.

so... run_adv($location[LOC_NAME])

or... location myloc = $location[LOC_NAME]; ..and then... run_adv(myloc);

As far as knowing if a choice adventure has occurred:

There is the mafia property "lastEncounter" that can be checked via get_property().

Also, each location has a combat & noncombat queue proxy.

So... myloc.combat_queue.contains_text("MONSTER_NAME") (or you can use index_of() > -1, if you like)
or... myloc.noncombat_queue.contains_text("CHOICE_OR_NONCOMBAT_ADV_NAME")

Or, again, you could do:
$location[LOC_NAME].combat_queue.contains_text("MONSTER_NAME") etc...

Edit:
You can type "ash $location[LOC_NAME]" into the cli to see what proxy fields are available for locations and their values for the location you chose.



Similarly,

ash $item[ITEM]
or
ash $coinmaster[CM_NAME]
or
ash $skill[SKILL_NAME]
or
ash $effect[EFFECT_NAME]


etc., for the mafia data types described on the page I linked.

Edit, example:


PHP:
> ash $location[The Enormous Greater-Than Sign]

Returned:     The Enormous Greater-Than Sign
nocombats => false
zone => Dungeon
parent     => Mountain
parentdesc => Big Mountains
environment =>     underground
bounty => none
combat_queue =>
noncombat_queue     =>
turns_spent => 0
kisses => 0
recommended_stat => 44
water_level     => 0

I haven't played any turns there so those queues are empty.
 
Last edited:

Pazleysox

Member
Also, you can run adventures in while loops.

PHP:
while (item_amount($item[plus sign])==0) {
   adventure(1, $location[The Enormous Greater Than Sign]);
}
I ran this:
PHP:
	while (item_amount($item[plus sign]) == 0 )
		{
		set_property("choiceAdventure451", 3); // Get Plus Sign
		adventure(my_adventures(), $location[The Enormous Greater-Than Sign]);
		}
I got the plus sign, and it kept running...

Ugh, I'm having so much trouble with this script. I really didn't think it would be this hard.

I can't figure out how to tell the script to look for the non-combat "the oracle will be with you".

I've tried this:
if(!myloc.noncombat_queue.contains_text("The Oracle Will See You Now"))
and
while(!myloc.noncombat_queue.contains_text("The Oracle Will See You Now"))
with and without the "!", neither worked.

PHP:
	if ($item[plus sign].available_amount() == 1)
		{
		print("have + sign");
		set_property("choiceAdventure451", 5); // Get teleportitis
		if(have_effect($effect[teleportitis]) <= 1)
		{
		adventure(1, $location[The Enormous Greater-Than Sign]);
		}
		cli_execute("use plus sign");
this just tried to use the plus sign.
 
Last edited:

ckb

Minion
Staff member
You are missing one key element of the while loop - it executes each task inside of it to completion before checking the conditional. So if you look at my original suggestion, it is this:
adventure(1, $location[The Enormous Greater Than Sign]);

your while loop runs through ALL your adventures before it checks if you have plus sign again.

Also - you can set the property before you enter the while loop so that it does not have to reset it during every iteration.
In thuis example, I also added a print statement to show what the "lastEncounter" property was so you can see what Mafia is reporting after every adventure.

PHP:
set_property("choiceAdventure451", 3); // Get Plus Sign
while (item_amount($item[plus sign])==0) {
   adventure(1, $location[The Enormous Greater Than Sign]);
   print("lastEncounter="+get_property("lastEncounter"),"blue");
}

To adventure until you get the Encounter "The Oracle Will See You Now", we use a while loop to adventure one time until we get this set as the "lastEncounter"

PHP:
while (get_property("lastEncounter")!="The Oracle Will See You Now") {
   adventure(1, $location[The Enormous Greater Than Sign]);
   print("lastEncounter="+get_property("lastEncounter"),"blue");
}

The tricky thing about using this method is that "lastEncounter" is a string, and you have to get it right to make sure that the text "The Oracle Will See You Now" matches exactly what Mafia reports it as. This is why printing "lastEncounter" after every adventure is useful to learn what each encounter is named.

Hope this helps!
 

Pazleysox

Member
Hope this helps!

It certainly did! I have to run a test on it again, but it seems to be working perfect now. I just have to tweak a few little things, and it should be good.

Thank you everyone so much for your help. It's really appreciated! I have certainly learned something I didn't know before! I should be able to roll the script out in a day or so.
 
Last edited:
Top