Dwarven Factory - Factory puzzle solver

Bale

Minion
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...
 
Last edited:

neminem

New member
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.
 

RobN

New member
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.
 
Last edited:
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.
 

Kime

New member
This was the first script I ever tried running and it worked perfectly! Thank you so much!
 

dragonslayere

New member
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
 

slyz

Developer
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

Developer
Staff member
Or, perhaps, he was running 8252, which broke mall purchasing and failed in the same way he logged. Fixed in 8253.
 

slyz

Developer
I just read about it and was about to edit my post to link to the bug report. 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.
 

Darzil

Developer
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.
 

breamas

New member
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

New member
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

Active member
Okay... there's some code on the item_amount page, namely this:
Code:
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:
Code:
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]
 
Last edited:

slyz

Developer
Not EXACTLY what we want, but it should be convertable to our needs like this:
Code:
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:
Code:
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.
 
Last edited:

Theraze

Active member
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. :)
 
Top