Results 1 to 8 of 8

Thread: Infinite Crafting Loop with Firewood

  1. #1
    Senior Member
    Join Date
    Apr 2018
    Posts
    358

    Default Infinite Crafting Loop with Firewood

    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 by Saklad5; 02-11-2020 at 03:35 AM. Reason: As Veracity points out, this is actually a coinmaster purchase.

  2. #2
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,525

    Default

    To get a bundle of firewood, it tries to use ten sticks of firewood.
    Originally Posted by Saklad5 View Post
    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.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  3. #3
    Senior Member
    Join Date
    Apr 2018
    Posts
    358

    Default

    This might be the first example of a currency that has a concoction that does that.
    Originally Posted by Veracity View Post
    I just skimmed through coinmasters.txt, and I believe you are correct.

  4. #4
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,525

    Default

    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:
    > inv firewood
    
    bundle of firewood (5)
    stick of firewood (357)
    
    > debugcreate stick of firewood
    
    stick of firewood.canMake(358) => 407
    
    stick of firewood.canMake(407) => 407
    
    stick of firewood.canMake(408) => 407
    
    > debugcreate bundle of firewood
    
    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).

  5. #5
    Senior Member
    Join Date
    Apr 2018
    Posts
    358

    Default

    I think this bug has since been reintroduced in r19743 or thereabouts.
    Last edited by Saklad5; 02-18-2020 at 03:45 AM.

  6. #6
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,525

    Default

    Looking.

  7. #7
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,525

    Default

    Lets try 19749.

  8. #8
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    13,525

    Default

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

    Revision 19786 should do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •