View Full Version : Dwarven Factory - Factory puzzle solver
That FN Ninja
11-04-2009, 05:09 AM
DwaFa 1.3 - Dwarven Factory puzzle solver
Dwarvish War Uniform here I come!
Previously dwarven_factory.ash. Thanks Veracity!!
This script automates the dwarven factory complex puzzle and retrieves the Dwarvish War Uniform item for you.
Requires Zlib (http://kolmafia.us/showthread.php?t=2072) & Miner.ash (http://kolmafia.us/showthread.php?t=2883)
User Preferences
boolean delivery_quest
If true will complete the Dwarven Factory Guild Quest (delivery service) before solving the factory puzzle.
boolean puzzle
Set this to false if you just want to use the script to complete the guild quest.
boolean buyore
If true the script will buy ore instead of mine for it.
WARNING: buyore is false by default. This script will spend adventures mining for ore if you do not change this to true before executing.
This is the order of the buying logic:
First dwafa.ash checks the script's buyore preference and if that is true it will try to buy all the required ore and abort if unsuccessful.
If buyore is false dwafa.ash passes control to miner.ash. Miner.ash tries to retrieve the ore, which means it might still buy it if autoSatisfyWithMall is true.
If miner.ash is unable to retrieve the ore it will then proceed to mine for the rest.
item transform
Specify the piece of mining gear to transform. By default the script will get a piece of the Dwarvish War Uniform that you do not already have. If you already have all the components of the Dwarvish War Uniform this script will just abort. If you are a collector change transform to bypass this abort. (i.e. If you collect Dwarvish War Helmets set transform to miner's helmet)
Here is an alias to complete the delivery service quest:
alias ds => ash import <dwarven_factory.ash> prep(); delivery();
Thanks to Veracity for adding Dwarven Factory support to KoLmafia.
If you find this script useful donations in the form of in-game ninja paraphernalia are always appreciated! Thanks and enjoy the script!
Change log:
11.08.09 - Added buyore boolean.
12.05.09 - Fixed a bug that was preventing the digit runes from getting parsed correctly.
09.24.10 - Re-named. Re-factored code. Converted aborts to exits and prints to vprints. Fixed a bug in the outfit item selection logic.
mottsy
11-04-2009, 01:37 PM
i love you...
this is exactly what i was looking for
thankyou
bumcheekcity
11-08-2009, 07:06 AM
Thanks! Althouh can I advise in future creations, that you have an option to simply BUY the ore? I have lots of meat and few adventures after I ascend :P
That FN Ninja
11-08-2009, 03:22 PM
Update v1.1
I added a buy ore option. It is untested, but should be fine.
Edit: The buyore feature has since been tested and works as intended.
gullebrand
11-09-2009, 08:56 PM
Good stuff, thanks a lot!
Shire Beyay
11-27-2009, 03:44 PM
when I ran this script, it gave an error:
End index 1 out of bounds (dwarven_factory.ash, line 236)
I'm sorry I can't give many details, but here goes: I hadn't started the quest, but the script got and identified the cards. I think it said, "ores identified" just before the error.
Subsequent attempts to run the script just seem to do a lot of adventuring in the Foreman's office.
Shire Beyay
11-27-2009, 03:51 PM
Oh yes, and before I started, I changed the delivery_quest to true.
When I switch delivery_quest back to false, I get the above error immediately.
Veracity
11-27-2009, 04:13 PM
How come you don't call this one "Dwa Fa" ? :)
siameseretriever
11-28-2009, 05:02 AM
Oh yes, and before I started, I changed the delivery_quest to true.
When I switch delivery_quest back to false, I get the above error immediately.
This is what I got...
You acquire an item: chrome ore
Miner, miner, you're quite the miner!
You acquire an item: lump of coal
Hooper ores identified!
End index 1 out of bounds (dwarven_factory.ash, line 236)
mad dudy
11-28-2009, 05:02 AM
omg i love you
That FN Ninja
11-30-2009, 02:22 AM
@Shire Beyay or siameseretriever:
Please type set lastDwarfDigitRunes into the gcli and post the result here.
How come you don't call this one "Dwa Fa" ? :)
Veracity, that is a very good question indeed! I guess I forgot to consult my idiosyncratic script-naming convention reference card! :D
i love you...
omg i love you
Aw-shucks. :o
siameseretriever
12-03-2009, 02:01 PM
@Shire Beyay or siameseretriever:
Please type set lastDwarfDigitRunes into the gcli and post the result here.
Sorry for the delay! I did this, and there was no response in the gcli. I reran the factory script, and got the same error again: End index 1 out of bounds (dwarven_factory.ash, line 236)
However, I did get this to run on another character, which is confusing.
P.S. I love you, too! This script is awesome!!
That FN Ninja
12-03-2009, 04:13 PM
@siameseretriever
Please try the attached version add tell me how it goes.
Edit: Fix implemented in v1.2
siameseretriever
12-05-2009, 05:20 AM
@siameseretriever
Please try the attached version add tell me how it goes.
Thanks, trying it now!
quechanmok
12-05-2009, 03:29 PM
I love this script. I used it successfully last ascension, but when I try to run the new version it gives me this:
Script parsing error (dwarven_factory.ash, line 25)
If this is something stupid I'm doing, please tell me.
That FN Ninja
12-05-2009, 04:01 PM
Honestly, I don't know what to tell you. I cannot reproduce this. If you've altered the script try redownloading. Line 25 is where it imports zlib. You could try to upgrade to the latest version of zlib, but I don't know why or if that would make a difference.
siameseretriever
12-06-2009, 03:21 AM
Thanks, trying it now!
It worked! FWIW, I am on ZLib version 11, and release 13.7.
That FN Ninja
12-06-2009, 05:32 AM
Update v1.2
Fixed a bug that was preventing the digit runes from getting parsed correctly on occasion.
quechanmok
12-06-2009, 02:59 PM
So, since it was giving me the parsing error when it was trying to import zlib, I tried importing zlib from the CLI, and it gave me a parsing error on zlib line 1. Any thoughts?
quechanmok
12-08-2009, 12:10 AM
Ok, I know I've done something stupid here. I am not getting a script parsing error (Line 1) on every script I run. I have re-downloaded Mafia and every script twice, and I get the same result.
Anybody have any clue what I've done?
Anybody have any clue what I've done?How could we know what you've done if we weren't looking over your shoulder. Please TELL us what you've done. Then we'll tell you what was wrong with it.
I'll only say that what you SHOULD have done is to download dwarven_factory.ash, zlib.ash and Miner.ash, put them all in your script directory and then call dwarven_factory. If you think that is what you did, then please tell us if you modified any of those files and how you called dwarven_factory. Perhaps you added a step in there that made sense to you? Odds are that obvious step you added on your own caused the problem.
Ok, I know I've done something stupid here. I am not getting a script parsing error (Line 1) on every script I run. I have re-downloaded Mafia and every script twice, and I get the same result.Assuming that "not getting" means that you are "now getting", could you tell us the full text of the error message?
Perhaps you've got an odd idea about how to run a script, so you should describe the process to us. Please use small words and don't assume we know what vague terms like "run" or "include" mean. They have more than one possible meaning. If you type something in the CLI, tell us you type it there and tell us exactly what you type. If you select something from a drop-down menu, tell us where the menu is. And so on...
quechanmok
12-10-2009, 06:48 PM
Ah. Apparently, I was saving them off the web incorrectly. I fixed it, I love the script, sorry for the bullshit!
neminem
01-02-2010, 05:53 PM
Very shiny. I got mafia just for the 11 script, but now that I have it all working and such, figured I might as well do other things with it too, like get my second piece of this outfit - I did the first one manually, really didn't feel like doing that again.
Granted, it wasted like 60 adventures before I noticed that buyore was false by default, but still. I had no other important plans for the day anyway. :)
I'll go find some ninja junk to send you now.
Grotfang
01-09-2010, 01:17 PM
I got mafia just for the 11 script
I do wonder for how many people that statement is true. Was a good time for mafia's popularity :)
Update v1.1
I added a buy ore option. It is untested, but should be fine.
Tried this for the first time today (using version 1.2, not 1.1). I'd already collected the laminated pages before I started. Set the buy ore option to true before I ran it. It still tried to adventure to collect ore for me. :( It used up the last of my adventures for the day.
No big deal, but it looks like this doesn't work yet.
That FN Ninja
01-16-2010, 08:39 PM
I don't see how that's possible. Since its release in v1.1 I have tested the buyore option and it works fine. Were your adventures actually used in the mine??
There is more to the puzzle than just getting the laminated cards. The script might use adventures getting the dwarvish punchcard, identifying the word ruin associated with the outfit item selected, getting the dwarf document that corresponds to the outfit item selected, pushing the red button (olny one adventure for the red button, but you get the point). There is also a guild quest option that if set to true the script will spend adventures getting the thick padded envelope. Adventures must be spent to complete the puzzle whether buyore is true or not.
So, please elaborate on this. You can post any pertinent cli output to this thread.
redwulf25_ci
01-17-2010, 06:02 AM
I do wonder for how many people that statement is true. Was a good time for mafia's popularity :)
That was a big selling point but I'm also glad I never have to manually do that F****** level 11 quest again.
This was the first script I ever tried running and it worked perfectly! Thank you so much!
dragonslayere
03-11-2010, 07:34 PM
buyore doesn't work for me...
Calculating how much ore is need for each hopper...
Buying the required ore:
4 asbestos ore
Searching for "asbestos ore"...
Purchasing asbestos ore (4 @ 375)...
Purchasing asbestos ore (3 @ 375)...
Purchasing asbestos ore (2 @ 375)...
Purchasing asbestos ore (2 @ 375)...
Purchasing asbestos ore (4 @ 375)...
Purchasing asbestos ore (4 @ 375)...
Purchasing asbestos ore (1 @ 375)...
Purchasing asbestos ore (4 @ 394)...
Purchasing asbestos ore (4 @ 395)...
Purchasing asbestos ore (4 @ 397)...
Desired purchase quantity not reached (wanted 4, got 0)
Unable to buy the neccessary asbestos ore!
also i think it would be more meat friendly if you used acquire instead of buy
buyore doesn't work for me...
also i think it would be more meat friendly if you used acquire instead of buy
The script only buys the quantity of ore you are missing, so anyhting you already have in your inventory will be used. And I don't see how acquire will buy ore without spending meat. If you want the script to use adventures instead, don't set it to buy ore. And if you were keeping ore in your closet, move it to your inventory before running the script. It's pretty much standard for scripts that use ressources to ignore the closet, in order for users to be able to 'hide' ressources from a script.
About your error, since the script doesn't check if you have enough meat before buying, maybe that was the problem? Or some bought the 4 asbestos ore @ 397 at the same time as Mafia did, hence the error when Mafia tried to buy an item that didn't exist anymore. Simply re-running the script should fix it.
Veracity
03-12-2010, 05:54 AM
Or, perhaps, he was running 8252, which broke mall purchasing and failed in the same way he logged. Fixed in 8253.
I just read about it and was about to edit my post to link to the bug report (http://kolmafia.us/showthread.php?3631-SVN-revision-8252-breaks-mall). His CLI output only shows one tentative, but that might be because buy() and the mall interface behave differently.
EDIT: oh wait, it does try several times. I read it as different ores, for some reason.
Thanks very much for the script. My previous manual attempt took way too long.
Darzil
05-08-2010, 11:36 AM
Tried this today, was looking pretty good til it got an odd error.
Looks like it only bought asbestos ore, then failed on Filling the Hoppers with "Something went wrong".
On a second run, it successfully bought the other ores, and then completed perfectly.
Richo the Dino
05-31-2010, 12:07 AM
Wow! Excellent script. Thanks, Ninja!
breamas
06-21-2010, 04:40 PM
I was having a problem and got the "Something went wrong" message. I used "Load in web browser" went into the mine and changed the desired item to something else and then back again and for some reason it worked.
The script is awesome!
PavoNariz
08-16-2010, 06:56 PM
I had trouble earlier because in finding the item to make, have_item() only checks inventory and equiped, while my first two pieces were still in Hagnk's, so it tried going for the helmet instead of mattock. It ran through my adventures because I forgot to save after I set buyore to true, then I saved and restarted, so it filled the hoppers, then tried pushing the button with no adventures, and I noticed it was trying to make the helmet instead of the mattock. I pulled my other items, and ran again after I had eaten for adventures, it was still having problems although just giving me the "Something went wrong!" message. To finally fix it, I set the fill hopper lines to print(), and saw that I needed -5 coal, -2 asbestos, -4 chrome, did that manually, hit the button, and finished my outfit.
I believe this would be fixed simply by adding display case and hagnk's checking to the section where have_item() is called.
Theraze
08-16-2010, 09:53 PM
Okay... there's some code on the item_amount page, namely this:
int item_count() {
item x = $item[knob goblin firecracker];
int counter = item_amount( x ) + closet_amount( x ) + storage_amount( x );
return counter;
}
Not EXACTLY what we want, but it should be convertable to our needs like this:
int item_count( item x ) {
int counter = item_amount( x ) + closet_amount( x ) + storage_amount( x );
return counter;
}Now, just replace the 3 'have_item' checks with 'item_count' and you should be fixed up... I'll test it out after rollover when I have some free adventures, but that should work. :)
Edit: Eh, slightly more complicated since have_item is a string checker, not an item checker. Replace the lines for the 3 have_items with these, which just changes "<item>" into $item[<item>]...[code] else if(item_count($item[dwarvish war helmet]) == 0){
oi = $item[miner's helmet];
print("Dwarvish War Helmet selected.","blue");
visit_url("dwarfcontraption.php?action=panelleft&action=doleftpanel&activatewhich3=%C2%A0%C2%A0%C2%A0%C2%A0&pwd");
}
else if(item_count($item[dwarvish war mattock]) == 0){
oi = $item[7-Foot Dwarven mattock];
print("Dwarvish War Mattock selected.","blue");
visit_url("dwarfcontraption.php?action=panelleft&action=doleftpanel&activatewhich2=%C2%A0%C2%A0%C2%A0%C2%A0&pwd");
}
else if(item_count($item[dwarvish war kilt]) == 0){/code]
Not EXACTLY what we want, but it should be convertable to our needs like this:
int item_count( item x ) {
int counter = item_amount( x ) + closet_amount( x ) + storage_amount( x );
return counter;
}
You should use available_amount() instead of item_amount(), because it counts equipped items too. Zlib's have_item() returns the same thing as available_amount(), but it takes a string instead of an item as parameter. To simply replace have_item() here, define item_count() to take a string as parameter:
int item_count( string x ) {
return available_amount( to_item(x) ) + closet_amount( to_item(x) ) + storage_amount( to_item(x) );
}
and replace all instances of "have_item" with "item_count" in dwarven_factory.ash.
Theraze
08-17-2010, 06:59 PM
Spiffy... yeah, used item_amount because that's what it had in their example; it didn't use available_amount because they were doing firecrackers instead of an equippable, ah well. And yeah, no real point in making a new variable that just gets returned the next line. Using the string conversion does make it a bit more complicated in the backend as there's 3 extra conversions going on, but if the client can't handle it, they really shouldn't be using any sort of script. :)
Updated my copy with your changes, and expect that to be useful when I finally stop running blackcat badmoon ascensions. :)
if the client can't handle it, they really shouldn't be using any sort of script. :)
I noted the smiley, but I can't resist pointing out that That FN Ninja's scripts are particularly user-friendly, and probably have many users who don't really need to understand ASH to enjoy them.
I don't think someone who uses one of his scripts (or any other script released for general public use) should be told to learn ASH when they point out a bug or make a feature request.
Theraze
08-17-2010, 10:03 PM
Something else to note, besides the smilie... "if the client" not "if the user". :) I was referring to underpowered computers, not newbie users. ;)
Somewhat confusing because of the following 'they', but it was the intent to point out that 3 additional calculations shouldn't break most people's computers. Heh.
That FN Ninja
08-17-2010, 10:06 PM
I had trouble earlier because in finding the item to make, have_item() only checks inventory and equiped, while my first two pieces were still in Hagnk's, so it tried going for the helmet instead of mattock.
Thank you for bringing this to my attention. I'm surprised no one has run into this problem yet. I will get it all ironed out for the next release.
@ Theraze & Slyz:
I'm not completely clear on what exactly is included in available_amount() and the wiki doesn't list that information. Does it consider the clan stash for example? I DO know that it includes the closet amount so the following code will result in inflated erroneous counts:
int item_count( string x ) {
return available_amount( to_item(x) ) + closet_amount( to_item(x) ) + storage_amount( to_item(x) );
}
Also, once someone has access to storage using available_amount() + storage_amount() will have the same problem. Items will be counted multiple times.
Also also, I don't think there is any need to use a string and convert it to an item.
I have a character who has just defeated the NS, so when I get a few minutes I'll test a fix. I am going to have it check the display case as well like PavoNariz mentioned.
Theraze
08-17-2010, 10:35 PM
Okay, so after reading, available_amount is a horrid choice because it's different for the character, depending on HC/SC, BC or not, pulls remaining, clan storage rules, etc. Better would be the following, to check everything but your clan, since those aren't necessarily yours...
int item_count( string x ) {
return closet_amount( to_item(x) ) + display_amount( to_item(x) ) + equipped_amount( to_item(x) ) + item_amount( to_item(x) ) + storage_amount( to_item(x) );
}
That should check your closet, display case, equipped, inventory, and storage, regardless of whether or not you can currently get your hands on them...
Woops, Sorry Theraze, I completely missed that.
And I learned something about available_amount()!
beatles and coke hippie
08-18-2010, 08:41 AM
Dude, thank you so much! Those numbers were just giving me a headache. This script is the only reason I downloaded kolmafia in the first place.
That FN Ninja
09-24-2010, 03:11 PM
Dude, thank you so much! Those numbers were just giving me a headache. This script is the only reason I downloaded kolmafia in the first place.You're welcome. ;)
Update v1.3
Re-factored code.
Converted aborts to exits and prints to vprints.
Fixed a bug in the outfit item selection logic.
Altered buying logic due to changes in miner.ash
Re-named according to previous Ninja script naming standards.
How come you don't call this one "Dwa Fa" ? :)
Veracity, that is a very good question indeed! I guess I forgot to consult my idiosyncratic script-naming convention reference card! :D
Good news. I found my idiosyncratic script-naming convention reference card! It was under my tenugui. Thanks Veracity for keeping this Ninja in line. Sometimes I get a little unruly.
Also, the ore buying logic has been altered due to some re-factoring in miner.ash. This is the order of the buying logic:
First dwafa.ash checks the script's buyore preference and if that is true it will try to buy all the required ore and abort if unsuccessful.
If buyore is false dwafa.ash passes control to miner.ash. Miner.ash tries to retrieve the ore, which means it might still buy it if autoSatisfyWithMall is true.
If miner.ash is unable to retrieve the ore it will then proceed to mine for the rest.
Theraze
09-24-2010, 07:39 PM
If it's been officially renamed, maybe the sig should get updated so people properly -fa at it? :D
So, would the proper name for Miner be OreMi or something like that then?
Awesome scripts, btw. I'll need to verify that the current check code still happily works with my BM idiots who try to run DF sometimes, but looking forwards to it. :D
Winterbay
09-24-2010, 10:01 PM
So, would the proper name for Miner be OreMi or something like that then?
DoReMi surely? :)
That FN Ninja
09-24-2010, 11:06 PM
If it's been officially renamed, maybe the sig should get updated so people properly -fa at it? :D
Yeah, didn't have time to edit my sig this morning when I posted the updates.
So, would the proper name for Miner be OreMi or something like that then?
According to my card (it's like the English language - there's an exception to every rule), it would be "Minor - Mining ore the Mafia way", but I didn't want anyone to think it was under age.
Awesome scripts, btw. I'll need to verify that the current check code still happily works with my BM idiots who try to run DF sometimes, but looking forwards to it. :D
Thanks. Let me know how it goes in BM.
Theraze
09-24-2010, 11:58 PM
Spiffy. Yeah, I was just looking at the little bit in your sig. AutOr didn't seem to make much sense, but OreMi (with Mi pronounced like Me/Mii) actually made a disturbing amount of sense. :D So would the official rename of DwaFa be "Dwarven Factory the Mafia way!" or something else? :)
I expect it to work... have_item() is item_amount and equipped_amount, and you add in closet_amount, storage_amount, and display_amount. It's not alphabetically sorted, but it includes all 5 of the possibilities. :D
That FN Ninja
09-25-2010, 12:19 AM
So would the official rename of DwaFa be "Dwarven Factory the Mafia way!" or something else? :)
Yeah, that or more indicative of the sentiments of the scripts user base: "Dwarven Factory without the headache way!"
tgetgel
01-11-2011, 05:33 PM
Running latest daily build with DwaFa v1.3, Miner v2.32, and options set to bye ore and include the delivery service!
15 turns and 40k meat and I have a brand new dwarvish war mattock.
Sweet! Thanks FN Ninja. :cool:
That FN Ninja
01-12-2011, 12:34 AM
You're welcome sir!;) Who knows... maybe someday I'll get the dwarvish war uniform myself. The good news is that I ascended for the first time earlier this month and I will now pretty much be hardcore for life! The bad news is I already opened the DoD and forgot to get the hobo glyph in the greater than sign. :o
tgetgel
01-12-2011, 01:50 PM
The good news is that I ascended for the first time earlier this month and I will now pretty much be hardcore for life! The bad news is I already opened the DoD and forgot to get the hobo glyph in the greater than sign. :o
I agree, HC for life! I missed the glyph on the road to the white citadel and others this ascension. I only got 1!:(
molotovh
04-16-2011, 02:49 AM
Never mind, I figured it out. I think...
Berserkas
05-30-2011, 12:19 AM
Hm... so i seem to be having this problem. I remember using the script quite some time ago.. worked fine. then quit KoL for more than a year, then started playing again. Whenever i try to run the script, i get this:
Function 'my_path()' undefined. This script may require a more recent version of KoLMafia and/or it's supporting scripts. (zlib.ash, line 271)
Got the newest mafia version (14.6), so... what's going on? My path? Is it something to do with Bad Moon?
I really don't have the slightest clue as to how any of this works, any help would be appreciated.
Get the latest release (the most recent .jar file) here (http://builds.kolmafia.us/).
Hello~
I tried to run this today and encountered this right off the bat:
Bad location value: "Knob Goblin Harem" (miner.ash, line 164)
Please let me know if I need to change something/provide additional information and I'll do so- thank you in advance!
Winterbay
03-27-2012, 06:40 PM
Oh, that's an old error... Change all instances of "Knob Goblin Harem" to "Cobb's Knob Harem".
floww
04-09-2012, 05:36 AM
I get an error when I use this script.
"Delivery Service quest completed.
Commencing Dwarven Factory Complex puzzle...
Getting the laminated cards and the punchcard...
Hopper check...
Selecting outfit item and identifying it's word rune...
Dwarvish War Helmet selected.
Visit to McLarge: Dwarven Factory Warehouse in progress...
[7357] Dwarven Factory Warehouse
You acquire an item: dwarf bread
Conditions not satisfied after 1 adventure."
my options are set as
boolean delivery_quest = true;
boolean puzzle = true;
boolean buyore = true;
I've already tried changing these options a bunch of times and rerunning the script. Everytime I do it costs an adventure though, and I've wasted about 30 >_>. Can anyone help?
Try typing "conditions clear" in the gCLI, and try again.
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.