Bug - Fixed Infinite Crafting Loop with Firewood

Saklad5

Member
I have a script that tries to acquire a burnt stick for decorating the Getaway Campsite tent. It is designed to fail if
Code:
$item[burnt stick].retrieve_item()
returns false (among other unrelated conditions).

When I run it early in an ascension, KoLmafia tries to acquire a burnt stick by spending a stick of firewood. To get a stick of firewood, it tries to use a bundle of firewood. To get a bundle of firewood, it tries to spend ten sticks of firewood. To get ten sticks of firewood, it tries to use a bundle of firewood. This loop continues forever, rather than giving up and returning false as expected.
 
Last edited:

Veracity

Developer
Staff member
To get a bundle of firewood, it tries to use ten sticks of firewood.
That is actually a Coinmaster purchase.

I was not aware that retrieve_item() would try to "create" Coinmaster currencies. This might be the first example of a currency that has a concoction that does that.

I'll take a look.
 

Veracity

Developer
Staff member
Revision 19732 will handle this case:

If we trying to create an item and there is a coinmaster concoction that yields it, if the coinmaster cost uses the item we are trying to make, use only the quantity you have on hand. I.e., don't try to create more.

Code:
[color=green]> inv firewood[/color]

bundle of firewood (5)
stick of firewood (357)

[color=green]> debugcreate stick of firewood[/color]

stick of firewood.canMake(358) => 407

stick of firewood.canMake(407) => 407

stick of firewood.canMake(408) => 407

[color=green]> debugcreate bundle of firewood[/color]

bundle of firewood.canMake(6) => 40

bundle of firewood.canMake(40) => 40

bundle of firewood.canMake(41) => 40
Given my inventory, I can "acquire" 407 sticks of firewood (have 357 and use 5 bundles of firewood) or 40 bundles of firewood (have 5 and trade in 350 sticks of firewood at the coinmaster).
 

Veracity

Developer
Staff member
That one broke creating concoctions wherein you had to buy ingredients of ingredients.

Revision 19786 should do it.
 
Top