PDA

View Full Version : Get Underground! (Digital Underground Potion farming)



palpitations
07-07-2009, 10:46 PM
I've been using this for a while... I posted something similar a while back on the KoL forums, not using exactly this farming strategy, but close enough. At the time, I got a few negative comments for hiding the exact details. Of course, anyone who had a positive message likely got a message from me with enough details to help them figure this out... So I guess it sucks to be negative, huh?

My apologies to anyone who's been making meat off of this. I was too. ~300-500k a day on average, for quite a while. Hell, I sent it to someone else, and they made about 750,000 meat overnight with it (700k-750k, they got lucky and were able to sell Digital Underground Potions for 47.5k each I believe).

I've been watching the prices over the past few days. I told myself, when there were 3 days in a row where I could make more doing something else, I'd post it. And so here it is.

Disclaimer: I suck at this, and I had a lot to drink when I wrote it. I cobbled together something piss poor. Everyone who actually knows what they're doing - I know, I know... I have no doubt this could be drastically improved. Everyone else: it seems to work. And it made me somewhere between 1,200 and 4,800 meat per adventure. You just need to make sure you have llama lama gongs on hand, and it'll pick up digital underground potions. Simple enough. And, on a positive note, I'll need some Digital Underground Potions soon, so feel free to lower the price on them as much as you'd like ;)


void usegong()
{
if (my_adventures() < 12)
{
print("Not enough adventures to get another potion. Stopping.");
exit;
} else
{
if (item_amount($item[llama lama gong]) == 0)
{
print("No more gongs! Aborting.");
exit;
} else
{
set_property("choiceAdventure276","2");
use(1, $item[llama lama gong]);
}
}
}

void molehill()
{
if (my_adventures() == 0)
{
print("Out of adventures.");
exit;
} else
{
while((have_effect($effect[Shape of...Mole!]) > 0) && (my_adventures() > 0))
{
visit_url("adventure.php?snarfblat=177");
use_skill($skill[tunnel downwards]);
run_combat();
}
}
}

void checkuse()
{
if (my_adventures() == 0)
{
print("Out of adventures.");
exit;
} else
{
if ((have_effect($effect[Shape of...Mole!]) == 0) && (my_adventures() > 0))
usegong();
else molehill();
}
}

void main()
{
if (my_adventures() == 0)
{
print("Out of adventures.");
exit;
} else
{
while (my_adventures() > 0)
checkuse();
}
}

Bale
07-07-2009, 11:01 PM
Nice script. Actually, it looks pretty well written to me. It could only be made a tiny bit tighter by setting gong properties once in main() instead of waiting until usegong() where it will be set every time a gong is bung. However that doesn't make much difference and I could not drastically improve that script unless there is a trick to more efficiently farming digital potions that I'm unaware of. Of which I am unaware.

I hope some people decide to run this script, because otherwise price on digital potions is going to be sky high as soon as the slimeling familiar is implemented.

palpitations
07-07-2009, 11:19 PM
It could only be made a tiny bit tighter by setting gong properties once in main() instead of waiting until usegong() where it will be set every time a gong is bung.

I actually realized this - but to be blunt, I was about 7 beers into the night when I wrote this. I didn't try to make something perfect, I just wanted to come up with something that came close to what I had in mind. I slapped it together right before going on vacation, so that I'd have a script to run on my netbook.

The fact that it works at all is a miracle, all things considered =P... Still, it apparently works, and that's all I looked for.

I might look at things at some point... But as it is, it should just be wasting a few cycles, right? To be quite honest, when it comes to a Mafia script as simple as this one, I don't give a damn about a few cycles. If I was working on something like your Recovery Script, I may care, but come on now, this is only ~60 lines. I can't do too much harm!

edit: I wish the DNS server was up sooner. I'd be interested in watching the markets after this. I'm not looking at playing the market, but I have a scholarly interest.

Bale
07-08-2009, 04:26 AM
That's why I said, "that doesn't make much difference." :D It really works quite well and couldn't be optimized too much further. Technically the check for my_adventures() in molehill() is not necessary since you've already checked to ensure you have 12 adventures left in usegong(), but I still think it is good to have the check there, just in case there is something weird that throws off the count.

Bear
07-26-2009, 05:49 AM
For one reason or another, I cant seem to get this working.

Its probably stupidity on my part.


this is the error message that is spat out:

Expected ), found 12 (Digital Potion.ash, line 3)

i'm meant to save it as a .ash file, right?

Bale
07-26-2009, 07:17 AM
It should be an ash file. I'd also caution you not to use wordpad since that will make it unusable. You need to you notepad instead. What editor did you use to save it?

Bear
07-26-2009, 08:04 AM
Notepad, and I'm pretty sure that I copied it exactly.

Edit: works now.

thanks for your help nevertheless.

Warren Jones
07-28-2009, 02:07 AM
Thanks for the script, it works great.

It's easy enough to switch from Digital Underground Potions to Climate Coladas.

However I was trying to modify it so as to get the Bureaucratized effect. Which means not using a skill every-time. I'm assuming the easiest way to do this is to not use a skill the first or last combat. So I changed

{while((have_effect($effect[Shape of...Mole!]) > 0)
to

{while((have_effect($effect[Shape of...Mole!]) > 1)
The problem is I have no idea how to make it adventure again. I've tried a couple different things and they either return parsing errors or are just ignored. Causing it to stop with the final adventure left.

It seems to be it should be pretty straight forward to adjust this, and even tweak it to get mole molé on the way.

If someone could point me in the right direction I'd really appreciate it. As I'm currently manually finishing each Shape of...Mole!

mredge73
07-28-2009, 01:32 PM
this is the adventure section:


visit_url("adventure.php?snarfblat=177");
use_skill($skill[tunnel downwards]);
run_combat();


This script manually adventures by first visiting the adventure location, then it selects the skill to use, then finishes the battle.
visit_url() clicks the link on the page that you want to adventure in, not sure how you get "Bureaucratized" but this may have to change
use_skill() uses a specific skill on the first round of combat
run_combat() runs your CCS.

Warren Jones
07-28-2009, 02:40 PM
visit_url() clicks the link on the page that you want to adventure in,

Hmm. What I need is to have it not use the skill for 1 turn. Preferably at/towards the beginning.

Maybe this is harder than I thought. Is there a way to set up a counter. Since there's only 12 turns (9 combats, 3 non-combats) I wouldn't be averse to scripting each turn. I'm just not sure how...

edit

Eureka (now to figure out how to make it ask how many adventures or gongs to use).



void usegong()
{if (my_adventures() < 12)
{print("Not enough adventures to get another potion. Stopping."); exit;}
else
{if (item_amount($item[llama lama gong]) == 0)
{print("No more gongs! Aborting."); exit;}
else
{set_property("choiceAdventure276","2"); use(1, $item[llama lama gong]);}}}

void molehill()
{if (my_adventures() == 0)
{print("Out of adventures."); exit;}
else
{if((have_effect($effect[Shape of...Mole!]) > 10) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); run_combat();}
else
{if((have_effect($effect[Shape of...Mole!]) > 0) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel upwards]); run_combat();}}}}

void checkuse()
{if (my_adventures() == 0)
{print("Out of adventures."); exit;}
else
{if ((have_effect($effect[Shape of...Mole!]) == 0) && (my_adventures() > 0))
usegong();
else
molehill();}}

void main()
{if (my_adventures() == 0)
{print("Out of adventures."); exit;}
else
{while (my_adventures() > 0)
checkuse();}}

This will get you Bureaucratized and mole molé.

psly4mne
08-03-2009, 05:52 PM
Is this any better than setting CCS to tunnel down, adding moleform to mood, and auto-adventuring in Mt. Molehill?

Rahmuss
04-05-2010, 11:40 PM
Ok, I'm trying to get it to do the unpopular effect. I obviously don't know enough about how it chooses the adventures. It runs and uses a gong and then tries to use two more gongs. What am I doing wrong?


void usegong() {
if (my_adventures() < 3) {
print("Not enough adventures. Stopping."); exit;
}
else {
if (item_amount($item[llama lama gong]) == 0) {
print("No more gongs! Aborting."); exit;
}
else {
set_property("choiceAdventure276","2");
set_property("choiceAdventure278","1");
set_property("choiceAdventure279","1");
set_property("choiceAdventure282","1");
use(1, $item[llama lama gong]);
}
}
}

void molehill() {
if (my_adventures() == 0) {
print("Out of adventures."); exit;
}
else {
if((have_effect($effect[Shape of...Mole!]) > 10) && (my_adventures() > 0)) {
visit_url("adventure.php?snarfblat=177"); run_combat();
}
else {
if((have_effect($effect[Shape of...Mole!]) > 0) && (my_adventures() > 0)) {
visit_url("adventure.php?snarfblat=177"); run_combat();
}
}
}
}

void checkuse() {
if (my_adventures() == 0) {
print("Out of adventures."); exit;
}
else {
if ((have_effect($effect[Shape of...Mole!]) == 0) && (my_adventures() > 0)) {
usegong();
}
else {
molehill();
}
}
}

void main() {
if (my_adventures() == 0) {
print("Out of adventures."); exit;
}
else {
// while (my_adventures() > 0)
checkuse();
}
}

heeheehee
04-06-2010, 12:41 AM
Uhh... Unpopular isn't available from Moleform -- you'd have to get into roachform. And anyway, the easiest way to get Unpopular is via the CLI command. So just cli_execute("gong roach ml"); and you'll be set!

Rahmuss
04-06-2010, 02:44 AM
hee (*3), you're absolutely right. I copied choice "2" from the previous script, so I need to change that to 1; but what I'd like to do is have a call to a script from a .txt file and in that file it will run the script x number of times (depending on the day or need). So I wanted to get it working with an actual .ash script. Thanks for pointing that mistake out though. Very helpful, with that little change it worked! Thanks heeheehee. :)

slyz
04-06-2010, 04:22 PM
Here's something to get Unpopular. Instructions inside.

EDIT: fixed a bug.

Khay
05-07-2010, 01:10 AM
Ok, I ATTEMPTED to modify this script to get the Morlock's Mark Bourbon, and using a green smoke bomb to do a free runaway later in the path after tunneling downwards, still manage to snag the digital underground potion. As I have never seen this particular programming language before - in fact, my personal experience is limited to BASIC and programming logic - I am certain I have messed up horribly :P But please take a look, and let me know what needs to be different to get this to work? What I HOPE to happen, is:

tunnel down the first 3 combats
first non-combat
tunnel down 2 more combats
stay at level -5 for the next combat
second non-combat (Bourbon)
tunnel down the next combat
tunnel down and runaway (smoke bomb) the 8th combat/10th adventure
tunnel down the next 2 combats
3rd non-combat (Digital Underground)

I cannot figure out how to check if the runaway succeeded, unfortunately, otherwise there should be an if/then to use another bomb; any help with that part?

I'd just make sure beforehand to have plenty of bombs, rather than check for them in the script; seems easier to me.

Please grade my paper? Lol... This is all copied and cannibalized from the other scripts in this thread - hopefully I have enough working parts here. I changed as little as possible.

void usegong()
{if (my_adventures() < 12)
{print("Not enough adventures to get another potion. Stopping."); exit; }
else
{if (item_amount($item[llama lama gong]) == 0)
{print("No more gongs! Aborting."); exit; }
else
{set_property("choiceAdventure276","2"); use(1, $item[llama lama gong]); }}}

void molehill()
{if (my_adventures() == 0)
{print("Out of adventures."); exit; }
else
{if((have_effect($effect[Shape of...Mole!]) == 6 ) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); run_combat();}
else
{if((have_effect($effect[Shape of...Mole!]) == 3 ) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); throw_item(green smoke bomb); visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); run_combat();}
else
{if((have_effect($effect[Shape of...Mole!]) > 0) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); run_combat();}}}}

void checkuse()
{if (my_adventures() == 0)
{print("Out of adventures."); exit; }
else
{if ((have_effect($effect[Shape of...Mole!]) == 0) && (my_adventures() > 0)) usegong();
else
molehill(); }}

void main()
{if (my_adventures() == 0)
{print("Out of adventures."); exit; }
else
{while (my_adventures() > 0) checkuse(); }}

heeheehee
05-07-2010, 03:46 AM
It looks like the first place it'll return an error is at "throw_item(green smoke bomb);". You'll need to use the datatype constant $item[green smoke bomb]; otherwise, Mafia will interpret it as a variable (and return an error).

The one minor nitpick I have is that it doesn't check if you have any green smoke bombs before proceeding. A simple call to retrieve_item() would work nicely. (See the wiki for syntax; I don't remember it off the top of my head. =D )

Khay
05-07-2010, 04:16 PM
So I want it like this?

else
{if((have_effect($effect[Shape of...Mole!]) == 3 ) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); $item[green smoke bomb]; visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); run_combat();}

Is that the right command?

Also, at the very beginning, if I changed it like this, would that work?

void usegong()
{if (my_adventures() < 12)
{print("Not enough adventures to get another potion. Stopping."); exit; }
else
{if (item_amount($item[llama lama gong]) == 0)
{print("No more gongs! Aborting."); exit; }
else
{if (item_amount($item[green smoke bomb]) > 3)
{print("Not enough Smoke Bombs! Aborting."); exit; }
else
{set_property("choiceAdventure276","2"); use(1, $item[llama lama gong]); }}}}


should check that at least 3 are left; if I fail escaping more than that, I would want to go into manual anyways, to monitor the fight :P

Camber
05-07-2010, 05:52 PM
So I want it like this?

else
{if((have_effect($effect[Shape of...Mole!]) == 3 ) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); $item[green smoke bomb]; visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); run_combat();}

Is that the right command?

Not quite, you still need the throw_item() command, like this:


if((have_effect($effect[Shape of...Mole!]) == 3 ) && (my_adventures() > 0))
{
visit_url("adventure.php?snarfblat=177") ;
use_skill($skill[tunnel downwards]) ;
throw_item($item[green smoke bomb]) ;
visit_url("adventure.php?snarfblat=177") ;
use_skill($skill[tunnel downwards]) ;
run_combat() ;
}





Also, at the very beginning, if I changed it like this, would that work?

void usegong()
{if (my_adventures() < 12)
{print("Not enough adventures to get another potion. Stopping."); exit; }
else
{if (item_amount($item[llama lama gong]) == 0)
{print("No more gongs! Aborting."); exit; }
else
{if (item_amount($item[green smoke bomb]) > 3)
{print("Not enough Smoke Bombs! Aborting."); exit; }
else
{set_property("choiceAdventure276","2"); use(1, $item[llama lama gong]); }}}}


should check that at least 3 are left; if I fail escaping more than that, I would want to go into manual anyways, to monitor the fight :P

I think you want to change the > 3 to < 3, i.e. if you have less than 3, abort.



if (item_amount($item[green smoke bomb]) < 3)


Or, instead of aborting, use heeheehee's advise and use retrieve_item to aquire one.


if (item_amount($item[green smoke bomb]) < 3)
retrieve_item(1, $item[green smoke bomb])

Khay
05-07-2010, 07:19 PM
Blah! Yeah, less-than. See, THAT'S why you always have someone proofread! Lol...

I still would like to make it check if I escaped, and if not, try again. But I honestly cannot find a thing on that, so I am at a complete loss there.

Ok, then lets see if I got this:

void usegong()
{if (my_adventures() < 12)
{print("Not enough adventures to get another potion. Stopping."); exit; }
else
{if (item_amount($item[llama lama gong]) == 0)
{print("No more gongs! Aborting."); exit; }
else
{if (item_amount($item[green smoke bomb]) < 3)
retrieve_item(1, $item[green smoke bomb]); }
else
{set_property("choiceAdventure276","2"); use(1, $item[llama lama gong]); }}}

void molehill()
{if (my_adventures() == 0)
{print("Out of adventures."); exit; }
else
{if((have_effect($effect[Shape of...Mole!]) == 6 ) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); run_combat();}
else
{if((have_effect($effect[Shape of...Mole!]) == 3 ) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); throw_item($item[green smoke bomb]) ; visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); run_combat();}
else
{if((have_effect($effect[Shape of...Mole!]) > 0) && (my_adventures() > 0))
{visit_url("adventure.php?snarfblat=177"); use_skill($skill[tunnel downwards]); run_combat();}}}}

void checkuse()
{if (my_adventures() == 0)
{print("Out of adventures."); exit; }
else
{if ((have_effect($effect[Shape of...Mole!]) == 0) && (my_adventures() > 0)) usegong();
else
molehill(); }}

void main()
{if (my_adventures() == 0)
{print("Out of adventures."); exit; }
else
{while (my_adventures() > 0) checkuse(); }}

Alright, I'll go field-test it, I guess is the next step. Thanks for all the help!

Khay
05-07-2010, 07:37 PM
Ok, getting this error:

Else without if (mole.ash, line 10)

Don't see any unassociated else commands, myself...

Camber
05-07-2010, 08:04 PM
Ok, getting this error:

Else without if (mole.ash, line 10)

Don't see any unassociated else commands, myself...

Found it, a couple of missing brackets. To Maintain your style, add a open bracket to this line: retrieve_item(1, $item[green smoke bomb]); }
to look like this: { retrieve_item(1, $item[green smoke bomb]); }

And then add another close bracket to the end of the usegong() function



void usegong()
{
if (my_adventures() < 12)
{print("Not enough adventures to get another potion. Stopping."); exit; }
else
{
if (item_amount($item[llama lama gong]) == 0)
{print("No more gongs! Aborting."); exit; }
else
{
if (item_amount($item[green smoke bomb]) < 3)
{retrieve_item(1, $item[green smoke bomb]); }
else
{set_property("choiceAdventure276","2"); use(1, $item[llama lama gong]); }
}
}
}


Are you using a coding editor? it helps by matching { } pairs for you and color-codes commands. I and many others use Notepad++ and Bale created an user-defined ASH language pack for it. Here (http://kolmafia.us/showthread.php?3770-Write-mafia-code-prettily!) is a forum discussion and how to use it.

Spiny
05-07-2010, 08:38 PM
Just a minor nitpic for future reference Khay, when pasting in your blocks of code, please enclose it within code tags so it looks easier on the eyes like in the others' posts. Thanks :)

Khay
05-07-2010, 09:55 PM
Camber - thanks a ton! Lol... the only "editor" I am using is Notepad.exe :P I don't actually do much (or really ANY) programming; I understand it, and am pretty good at it once I learn the syntax for whatever particular language, but I do other things for fun, usually, instead of this :)

Spiny - sorry :D I noticed what they were doing, but not HOW, so I just posted. I'll search around and figure it out if I need to post more code, though. :)

Khay
05-07-2010, 10:18 PM
Alright, crud. New error was:

main method must appear at top level (mole.ash, line 40)

I looked carefully at the script, and decided "to heck with it", and just to at least test it out, got completely rid of both the checkuse and main sections, and added another bracket to the end of the molehill part, as it needed it. Then, wonder of wonders, it loaded the script! Woo-hoo!

Ummm... at this point, I realized I am a complete idiot/noob, because...

Ok, once the script is loaded, how do I RUN it? I cannot find anything that says "run script(s)"... yeah.

heeheehee
05-07-2010, 10:26 PM
All right. Since throw_item() returns a buffer, the relevant bit of code to see if it throws the item or not... would be:


while(throw_item($item[green smoke bomb]).contains_text("Looks like that one was a dud.")) {
print("Failed to run away. Using another green smoke bomb");
}


Running it is as simple as placing it in your \mafia\scripts directory, then running the script via the Scripts dropdown, where it should appear (Try refreshing the menu if it isn't there).

Spiny
05-10-2010, 10:42 AM
Spiny - sorry :D I noticed what they were doing, but not HOW, so I just posted. I'll search around and figure it out if I need to post more code, though. :)

Code blocks are merely pasting what you have and preceding it with the word code enclosed in square brackets [] and ending the block with /code also enclosed in square brackets.

that_bloke
06-08-2011, 05:58 PM
Sorry for the necro, but I tried using this script and couldn’t get it to work..
I msg’ed the OP about 2 weeks ago and didn’t get any info... Could someone help me resurrect it so I can do some Und.Potion farming... thanks!

Winterbay
06-08-2011, 06:50 PM
If you tell us the CLI-output you get when trying to run it it will be easier :)

Bale
06-09-2011, 04:33 AM
So many possible errors without any information that it is hard to know what the problem is. Should we start gambling about what his error was? My bet is that he used a text editor that added formatting characters.

that_bloke
06-09-2011, 07:07 PM
Sorry for that! I really thought I was missing something (like copy the code into this ‘nifty program’, press play, and get an .ash output to be used to kolmafia) because I used TextEdit (OS X) to basically copy/paste the block of text and run it in Kolmafia.

The output I get is: Script parsing error (Underground.ash.txt, line 1)

The file is in my Scripts folder and it’s called Underground.ash. Other scripts, which have been edited for little things (i.e. the SlimeTube one) are recognized even though it states Slime.ash.txt in kolmafia.

Bale
06-09-2011, 08:00 PM
The output I get is: Script parsing error (Underground.ash.txt, line 1)

Yay! I win the bet!

The problem is that you copy-pasted the script into a text editor that adds formatting characters. Use a text editor that only handles plain text and is incapable of formatting.

Theraze
06-09-2011, 08:00 PM
Depressingly, when you get that message, you usually have to open the script in a hex editor and remove the 3 weird characters at the front of the file. Not sure what causes it, but I've been having it happen with BatBrain fairly consistently for the past week or three.

It's not just editors capable of formatting... Windows Notepad (not Notepad++) doesn't format, but had been causing this for me.

Bale
06-09-2011, 10:11 PM
Huh. I'd thought that notepad was safe even though wordpad was a bust. OS X will run notepad++ (http://notepad-plus-plus.org/), right?

that_bloke
06-10-2011, 12:32 AM
Huh. I'd thought that notepad was safe even though wordpad was a bust. OS X will run notepad++ (http://notepad-plus-plus.org/), right?

Ughhh.. I wish I was this ^ smart to have figured it out.

Notepad++ will run but under a Win Environment... I’ll get a hex editor and see if the way suggested by Theraze fixes the issue. All in all, thanks for the input all!

Ok, downloaded Hex Fiend, tried to remove the 3 characters added and got another message.. went over again at the code the OP posted and copy/pasted it into Hex Fiend and now it works.. like a charm!

roippi
06-10-2011, 01:37 AM
I'm sure OSX comes with at least one of VI(m)/emacs/nano/pico. In the future you can use one of those.

Ethelred
06-10-2011, 02:08 AM
Get TextWrangler from Bare Bones Software. It's a great free programmer's text editor for MacOS X. Will even find those nasty little gremling characters for you.

Pyren
07-06-2011, 08:03 PM
Actually, none of those solutions are really necessary in OS X. Opening the script in Textedit, simply go to Format -> Make Plain Text. Then File -> Save As... and add .ash to the filename. It should prompt you to make sure that you really want to use .ash as the file extension, simply click .ash in the prompt box and you should be good to go.

In the future, you can set your Preferences for TextEdit to default to plain text instead of rich text. It's under the menu TextEdit -> Preferences... -> New Document - Format.

Having done that, I was able to use the script successfully, no parsing errors left.