Crimbo Mining Script

bombar

Member
crimboMining.ash - A Crimbo Mining Script

Threw together a Mining Script that mines the crimbo mine, requires you to be running 'Crimbonar' when starting each mine.

http://pastebin.com/hbr72cQL (v1.14) (Note recommend to use Mafia r15029 or later)

Features:
For a given Crimbo mine this program will figure out the shortest path to get all the nuggets of Crimbonium in least number of mining attempts
Ability to skip mines where Crimbonium clumps might contain cave ins, skipping requires 1 mine attempt before getting new cave
Ability to mine extra peppermint trailing
Allows you to use script for mining even it will cost you turns, by default disabled
Multiple ways to heal after a cave-in: mafia restore, specify healing or just spend 10 meat and get a hp from Docs
Avoids cave-ins as much as possible, uses assumptions when you have found 6 nuggets, all rest interesting spots are cave ins, nuggets can't be in bottom two rows

Configurable options:
maxFailsAllowed = int;
How much bigger a set of continuous interesting points can be more then 6, if you were to explore all in bigger chains, you are guaranteed a cave in
Setting this to 4 will make it so no mine is skipped because of length of chain

maxCaves = 50;
Max caves to check against, mainly to solve for infinite loops just in case

requireFreeMining = boolean;
Whether to force no turn used, if true, you either have to have minin' dynamite in inventory or have the oily legs buff up

useDynamite = boolean;
Whether or not to use minin' dynamite, setting to false will store dynamite in closest, required mafia r15029 or later to work.

numTurnsToLeave = int;
When requireFreeMining is false, and you are using turns to mine, this will allow you to tell the script how many turns you want left over when done mining.

delayBetweenMines = int;
In seconds, This will allow you to add delays after each mining attempt, used to spread out server load espically if you are starting script and letting it run while you go do other things and don't care when it finishes

maxExtraNuggets = -1;
Set to -1 if you don't want to use this value and just mine as many nuggets as you can, else will mine nuggets in a given mine until you reach your current number of cylindrical molds + maxExtraNuggets

mineOnlyPeppermints = boolean;
Setting this to true will make it so you will only mine basic chucks of walls for peppermints and mine no nuggets, highly recommend to up minNumberTailsPerCave to something greater then 20 to reduce serverload, the code will automatically do this if its set to a number less then 12

minNumberTailingsPerCave = int;
This property will allow you to mine additonal peppermint tailings after finding all the nuggets in a given cave. Setting to 26, will try to clear entire cave except for the cave-ins, note, if a tailing is cut off from bottom by cave ins (surronded on all side) it won't trigger cave-ins to get to them.

useMafiaRestore = boolean;
This property will allow you to attempt to use the internal mafia restore to heal a single hp if after a cave-in you are at 0 hp, it it fails it will attempt to use Docs

healingSkill = $skill[<skill name>]
Use this skill instead of docs for healing after a cave-in, if value is $skill[none] it will just use doc's, not only used if useMafiaRestore is false

Sample Output
Number of Fully Explored Caves: 36
Number of Caves Skipped because chain to large: 2
Number of Cave Ins that occurred: 23
Number of peppermint tailings found: 119
Number of nugget of Crimbonium found: 216
Number of seconds it took: 798.0
 

Attachments

  • crimboMining.ash
    18.4 KB · Views: 191
Last edited:

bombar

Member
ToDos:

Version History:
1.14 - When using adventures to mine, when it ran out of adventures it still looked up to max number of caves, causing extra server hits, issue fixed, also added ability to stop mining with X turns left
1.13 - Added ability to specify how many more nuggets you want before switching to mining only peppermints
1.12 - Added the ability to force a delay between mine attempts
1.11 - Flag that allows you to only mine peppermints
1.10 - Allow object detection when parsing a fresh mine instead of just Crimbonar (untested)
1.9 - Abort script when requireFreeMining is true and about to mine an interesting node with no oily legs buff
1.8 - Added parameter to control minin' dynamite usage, also a warning message when about to mine using an adventure.
1.7 - Added code to see how long it takes to complete
1.6 - Added config option that allows for mafia's restore_hp logic to be used
1.5 - Added ability to specify a healing spell to heal, if it fails falls back to using Doc's
1.4 - Added ability to mine peppermints after finding all the nuggets
1.2 - Added equipping of the Xiblaxian holo-wrist-puter if you have one in inventory
1.1 - Had hardcoded to use Tongue of the Walrus to heal (opps), switched it use doc healing (credit Ezandora)
1.0 - Original Version

Current Limitations/Known Issues
Biggest limitation I ran into is the fact that when doing the url request to get the current state of the mine, it doesn't include what was mined at each location, therefore the script will request a virgin mine to start with.
If useDynamite = true, update to version r15029 or later since before this build there is an issue with the tracking of minin' dynamite inventory when being used in mine
 
Last edited:

Immelan

New member
Love it. My time spent mining just went from hours to minutes. Is there any way we can specify a casted heal vs buying something from Doc? I'm typically sitting at over 1k mana when I run this.
 

Bale

Minion
Is there a reason you don't just use restore_hp(1) to restore HP so that a player's healing script can figure out the best method?
 

bombar

Member
Is there a reason you don't just use restore_hp(1) to restore HP so that a player's healing script can figure out the best method?

Two reasons:
1. I don't usually use that functionality so have never used it in a script before
2. Was worried about overkill/didn't know you could specify a hp value to heal to, thought it would take into account your restore levels and mine are set to restore to 90% which would have been overkill

That being said, now that I learned you can specify a value will most likely add in the ability to do just this

Thanks, for suggestion.

Edit: Implemented in v1.6
 
Last edited:

Valliant

Member
I'm not sure what failed, but your script didn't stop when Oily Legs ran out, only when Crimbonar did. I hadn't changed anything in the script but the tailings number. Using Version #15024.
 

bombar

Member
I'm not sure what failed, but your script didn't stop when Oily Legs ran out, only when Crimbonar did. I hadn't changed anything in the script but the tailings number. Using Version #15024.

Sent you a message, but reviewed logic and don't see anything obvious, haven't heard anyone else reporting this, would recommend checking value for requireFreeMining make sure it equals true.

That being said, just uploaded a new version (1.8) that includes a message when about to mine using a turn, hopefully this can help figure out why its not working.
 

Valliant

Member
I think I may have figured out the problem. I accidentally used some minin' dynamite in the cave, and then closeted the rest. KOL Mafia wasn't properly recognizing dynamite use in the Crimbo cave, so your script saw that KOL Mafia thought that I had some in my inventory, despite there being none available. So then it kept mining, thinking that there was the dynamite to give a free turn, despite it not working that way anymore.
 

bombar

Member
Great to hear you got it working, added it to the known issues section, will test myself and most likely create a bug in the forums.

Update:
Verified bug, submitted a post in bug report forum

Turns out that when using minin' dynamite for free turns, it isn't used when exploring promising chunks of wall that contain nuggets of crimboium, it only gives you free turns when mining basic chunks that give you peppermints.

Not sure how I should address this in the script, going to add this as a note for now.
 
Last edited:

Valliant

Member
Having updated to 1.8, using #14925, I'm now getting "Bad effect value: "Oily Legs" (crimboMining.ash, line 346)" from Mafia when I try to run. I can find line 346, and it is: "int numTurnsOilyLegs = have_effect($effect[Oily Legs]);", but I don't know what to do with that.
 
Last edited:

Veracity

Developer
Staff member
Having updated to 1.8, using #14925, I'm now getting "Bad effect value: "Oily Legs" (crimboMining.ash, line 346)" from Mafia when I try to run.
No surprise, considering the first KoLmafia revision with Crimbo mining camp support is 15020.
 

Valliant

Member
Oh, arg. That's what I get for not deleting my old daily updates and opening the wrong thing. My bad. At least putting in relevant info made this an easy one to solve. *facepalm*
 
Last edited:

bombar

Member
Glad it was an easy fix, is it working now?

Just uploaded v1.9, added a note that you should upgrade to r15029 or later,

Went ahead and added in an extra check to make sure in the case of using dynamite with no oily legs that if you have specified to not use turns it will abort the script when it encounters an interesting node which isn't a free turn when using dynamite.
 
Top