Results 1 to 8 of 8

Thread: Auto use meat-drop and item-drop items.

  1. #1

    Default Auto use meat-drop and item-drop items.

    Really basic script to figure out if I have items that drop other items or that drop meat and use them right away.

    The impetus for this was "I have how many Penultimate Fantasy Chests in inventory?"

    I didn't want to have to make and maintain a list of items to use (which is different from sell or destroy), so I wanted to use the Boolean_modifiers "Drops Meat" and "Drops Items"

    So far so good, but it seems to miss things, like Warm Subject Gift Certificates:

    Here's the script:

    void main()
    item myItem;
    foreach myItem in $items[] {
    if (boolean_modifier(myItem,"Drops Meat") && item_amount(myItem) > 0)
    	print(myItem + " is a meat dropping item");   
    if (boolean_modifier(myItem,"Drops Items") && item_amount(myItem) > 0)
    	print(myItem + " is an item dropping item");
     } //  end foreach item
    } // end main
    What am I doing wrong?

  2. #2


    Drops Meat and Drops Items are for equipment that drops meat/items during combat, like KoL Con 13 snowglobe. I don't think there's anything that would be useful for the script you want.

  3. #3
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    The Unseelie Court


    In VMF, I have a hard-coded list of items that I will auto-use at the end of my daily run (not immediately after I acquire them, which would go in a between battle script, or something).

    // Items dropped by Mr. Screege's spectacles or other equipment which will be "used"
    // *** Must contain at least one token. Use "none" for no items.
    static item_set GENERAL_USE_LOOT = $items[
         ancient vinyl coin purse,
         black pension check,
         CSA discount card,
         duct tape wallet,
         fat wallet,
         old coin purse,
         old leather wallet,
         pixel coin,
         pixellated moneybag,
         shiny stones,
         solid gold jewel,
         stolen meatpouch,
         Gathered Meat-Clip
    Not to say you should use this specific list, but, yeah - I think you have to make your own list. We don't have built-in modifiers for "items which drop meat or items when you use them".

  4. #4


    Thanks for the clarification.

    I looked in modref and I made a bad assumption (because there are numeric_modifiers for Meat Drop and Item Drop, I assumed the bools were what I wanted).

    But it is "drops" and not "contains", so I guess it's on me.

    So back to revision1, which was iterating over a list of items.

    the wiki has a category for items with meat in them, which makes that a good start. I just need to find or make a list of things which, when used, drop other things...

  5. #5


    I haven't decided if I want it to be a between battle script or a on login script. First I was going to get it working, then I was going to figure out if I should reasonably delay it or if iterating through 30-40 items and using some if they showed up was quick enough for between battles.

    Is the static item_set (constant?) CONTAINS_LOOT something that it would be useful to add to KoLmafia for anyone who wants to use it?
    Last edited by MCroft; 02-09-2020 at 07:28 AM.

  6. #6


    This is auto-use loot script. It's got a few additions in the loot string and it doesn't use item_set, but it works.

    additions welcome.

    void main()
    static String CONTAINS_LOOT = "ancient vinyl coin purse,bag of park garbage,black pension check,black picnic basket,briefcase,canopic jar,chest of the Bonerdagon,collection of tiny spooky objects,CSA discount card,dungeon dragon chest,duct tape wallet,fat wallet,flytrap pellet,Gathered Meat-Clip,giant jar of protein powder,kobold treasure hoard,LOLmec statuette,meat globe,nest egg,old coin purse,old leather wallet,Penultimate Fantasy chest,pixel coin,pixellated moneybag,old coin purse,red box,Roll of meat,shiny stones,solid gold jewel,stolen meatpouch,Warm Subject gift certificate";
    String[int] lootArray;
    lootArray = split_string(CONTAINS_LOOT,",");
    int myIndex, itemCount;
    item myItem;
    int myItemCount;   
    foreach myIndex in lootArray {
        myItem = to_item(lootArray[myIndex]);
        myItemCount = item_amount(myItem);
    	if (myItemCount > 0) {
    		// print(myItem + " is a loot dropping item.  Count: "+myItemCount);
    		use(myItemCount, myItem);
    		} // end if
     	} //  end foreach LOOT_ARRAY
    } // end main

  7. #7
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Seoul, Korea


    I would like to mention that there are some publicly maintained maps on the Map Manager of items that drop meat or items when used. Your script can access and load them with just three lines of code:

    import <zlib.ash>
    float[item] useformeat;
    At this point your script will be able to reference two maps, one for meat and another for items.

    1) The useformeat variable contains a float[item] map, with items keyed to the average amount of meat they produce when used.
    b) The useforitems variable contains a float[item, item] map, with items keyed to the items they produce, which are in turn keyed to the average amount of that item dropped (frequently less than 1). This map is already loaded into a global variable by ZLib so you don't need to load it in your script.

    Your script could then foreach both of these maps, add perhaps a little logic for skipping certain items (I'd recommend a test script first before actually using all the items) or not using unprofitable items (perhaps the container is worth more than the contents), and then use the rest!
    Sig by JakAtk
    My scripts: Prefref Plus | Skillref Plus | One-Click Woss | Om****est (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mercenary Mood | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | Drag-n-Drop Inventories | CanAdv | Script Registry | Map Manager
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  8. #8


    Just what I wanted. Thank you.

Posting Permissions

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