Feature - Implemented Track free mining with Unaccompanied Miner

slyz

Developer
It would be nice to have a daily preference where the number of free mining turns used are stored.

For backround: Unaccompanied Miner simply makes your first 5 turns spend mining in the Itznotyerzitz Mine or the Anemone Mine not cost an adventure.

It's not an important/urgent request, and I haven't looked at Mafia's code yet so I don't know if it's technically possible, but I just wanted this request to be out here just in case. It would be mostly for scripts I guess, since there aren't any ways in-game to know if the free turns have been used or not, but it might also help forgetful speed runners =)
 

lostcalpolydude

Developer
Staff member
You can at least tell if the next click will be free. Normally, the page says
INSTRUCTIONS: Starting at the bottom of the mine, click a chunk of rock adjacent to an open section of mine to excavate that space. Mining a chunk of the cavern wall takes one Adventure.
When you first walk in with this skill, it doesn't say that an adventure will be used (I didn't save the text unfortunately, I just remember reading it carefully looking for that bit.
 

heeheehee

Developer
Staff member
Simple relay override (mining.ash), maybe?

PHP:
buffer results;
results.append(visit_url());
if(have_skill($skill[Unaccompanied Miner] && results.contains_text("takes one Adventure.")) results = results.replace_string("<a href='mining.php?", "<a onclick='return confirm(\"WARNING: Mining will take one adventure. Continue anyway?\")' href='mining.php?");
results.write();

Only fires if you have the skill Unaccompanied Miner; otherwise, it'd get kinda "annoying", no? :)
 
Last edited:

lostcalpolydude

Developer
Staff member
That is kind of an issue with relay overrides, you'll need a separate file for each of the three mines. It looks useful though.
 

heeheehee

Developer
Staff member
Yeah, I wish there were some way to apply the same script to multiple pages, like with GM. But it really doesn't seem practical for ASH. Bouncing some ideas around in my head, but nothing seems foolproof.
 

oly0015

Member
Here's my way to get the answer, if you try this it should spit out true or false at the end. Unlike HeeHee my idea was to grab the line "x adventure" on the intro page that appears if your out of free uses. It's not perfect but at least this way its a T/F check to see if it can work or not.

http://kolmafia.us/showthread.php?4748

- fixed due to heeheehee's suggestion
PHP:
boolean checkfreemine()
{
	string test = "Adventure";
	string url = "mining.php?intro=1&mine=1";		
	boolean urltest = visit_url(url).contains_text(test);
	//Flip output to print true if theres a free mine
	if (urltest) urltest = false;
	else urltest = true;
	return urltest;
}
 
Last edited:

heeheehee

Developer
Staff member
Why not set urltest to !(visit_url(url).contains_text(test)) and forego the if/else statement? Also, I guess you could just search for "Adventure" in the page, and that'd work. I guess. (Also, anemone mine takes two adventures? Is this with/without Fishy? Does fishy even make a difference?)

Edit: Wiki says Fishy makes a difference. So I'd just search for "Adventure" or something like that, assuming that that word doesn't appear anywhere else on the page.

Double edit: Also, huh, that change would guarantee that the relay override would work for all three mines. Hadn't bothered to check that they all call mining.php, but since that's the case, there'd be no need for multiple files / symlinks.
 
Last edited:

oly0015

Member
They seem to have updated it now so just searching for the word Adventure won't work. I noticed this on the find new cavern button today... "This does not take an Adventure."

This seems to work for now
PHP:
	string test1 = "one Adventure";
	string test2 = "two Adventure";
	string url = "mining.php?intro=1&mine=1";	
	boolean urltest;	
	if ((visit_url(url).contains_text(test1))||(visit_url(url).contains_text(test2)))
		urltest = false;
	else
		urltest = true;
	print (urltest);
 

heeheehee

Developer
Staff member
return visit_url(url).contains_text("does not take an Adventure"); instead of the last six lines or so?
 

Theraze

Active member
Wouldn't that knock out the top 2 lines as well, since they aren't being used? In fact, could do the whole thing as one line like
Code:
return visit_url("mining.php?intro=1&mine=1").contains_text("does not take an Adventure");

Or could make it a bit more descriptive... Let's turn this into an alias:
Code:
alias freemining => ashq print("You have free mining available: " + visit_url("mining.php?intro=1&mine=1").contains_text("does not take an Adventure"));
 
Last edited:

heeheehee

Developer
Staff member
Yeah, pretty much. Was just building off of what code he had. But yeah, I'd still go with a relay override if I had the skill (to be permed eventually).
 

Theraze

Active member
Perm-able but not auto-perm according to the wiki. Easy to get though, got it my first adventure with the galoshes...
 

oly0015

Member
Yeah the one line works better, that was just my quick fix while getting pestered in kol by someone that downloaded my script. I'm not too worried about it, its just part of a much larger function i'm working on anyway. So any progress towards what slyz asked for in the first place?
 

Terion

Member
Since it's a tome skill, isn't it auto-perm?

But it's not a tome skill, like Snowcones or Sugar Sheets, that goes on your bookshelf.

It's like the hobo skill books, where you have to perm the skill if you want to keep it. (Or Summon Crimbo Candy, or the Crimbo Carols Ch 1-6, or the Trader skills, ...)
 

Blabo

New member
Is there a reason this was never done? It would be very nice to have and I wouldn't think it is that hard to implement. I keep forgetting to use my 5 free mining turns every day in aftercore.

Also with the book being usable every ascension now, it's more relevant even if you haven't permed the skill yet.
 
Top