Can someone review my farming script and give me some tips on it?

HasteBro

Member
I haven't really tested it yet since it's not complete, but I have some questions regarding it, they're all in the script after the ##

I know the script relies heavily on cli_execute(), most of the questions are exactly about that, if anyone has any tips on that, do share with me =)

Code:
cli_execute("breakfast");
foreach it in $items[cold wad, hot wad, stench wad, sleaze wad, spooky wad]
{
	buy(3, it);
}
use_skill(3, $skill[rainbow gravitation]);

## Function for sending meat?
cli_execute("csend 1 meat to HastyBuffer");
cli_execute("csend 2 meat to HastyBuffer");
cli_execute("csend 3 meat to HastyBuffer");
cli_execute("wait 60");

use(2, $item[Milk of Magnesium]);
## Will it buy the cheapest?
foreach it in $items[hot hi mein, cold hi mein, stinky hi mein, spooky hi mein, sleazy hi mein]
{
	min(mall_price(it, it);
	buy(3, it, 3500);
	eat(3, it);
}

equip($item[brimstone beret]);
use_skill(3, $skill[ode to booze]);
drink(3, $item[cherrybomb]);
drink(1, $item[pumpkin beer]);

use(3, $item[agua de vida]);
use(1, $item[prismatic wad]);

use_skill(1, $skill[canelloni cocoon]);

maximize("2.0 meat, 0.75 HP", false);
if(available_amount($item[stinky cheese eye] = 0)
{
	cli_execute("squeeze stinky cheese eye");
	equip(acc3, $item[stinky cheese eye]);
}
else
{
	equip acc3 stinky cheese eye
}

if (have_familiar($familiar[Obtuse Angel]) = true && my_familiar() = !$familiar[Obtuse Angel]);
{
	use_familiar($familiar[Obtuse Angel]);
}
equip(fam, $item[quake of arrows]);
cli_execute("call aftercore.ash");

if (have_familiar($familiar[baby sandworm]) = true && my_familiar() = !$familiar[baby sandworm]);
{
	use_familiar($familiar[baby sandworm]);
}
equip(fam, $item[Li'l Businessman Kit]);
add_item_condition(5, $item[agua de vida]);
adventure(my_adventures(), $location[Giant's Castle]);
equip(fam, $item[none]);
## Is this how you unequip?

if (have_familiar($familiar[rogue program]) = true && my_familiar() = !$familiar[rogue program]);
{
	use_familiar($familiar[rogue program]);
}
equip(fam, $item[Li'l Businessman Kit]);
add_item_condition(5, $item[game grid token]);
adventure(my_adventures(), $location[Giant's Castle]);
equip(fam, $item[none]);

if (have_familiar($familiar[llama lama]) = true && my_familiar() = !$familiar[llama lama]);
{
	use_familiar($familiar[llama lama]);
}
equip(fam, $item[Li'l Businessman Kit]);
add_item_condition(5, $item[llama lama gong]);
adventure(my_adventures(), $location[Giant's Castle]);
equip(fam, $item[none]);

if (have_familiar($familiar[Li'l Xenomorph]) = true && my_familiar() = !$familiar[Li'l Xenomorph]);
{
	use_familiar($familiar[Li'l Xenomorph]);
}
equip(fam, $item[Li'l Businessman Kit]);
add_item_condition(5, $item[transponder transporter]);
adventure(my_adventures(), $location[Giant's Castle]);
equip(fam, $item[none]);

if (have_familiar($familiar[hobo monkey]) = true && my_familiar() = !$familiar[hobo monkey]);
{
	use_familiar($familiar[hobo monkey]);
}
equip(fam, $item[Li'l Businessman Kit]);
adventure(my_adventures(), $location[Giant's Castle]);
equip(fam, $item[none]);

## Is there afunction for buying raffles?
cli_execute("raffle 20");

equip($item[brimstone beret]);

use_skill(1, $skill[ode to booze]);
drink(1, $item[cherry bomb]);

## Is there a function for squeezing?
cli_execute("squeeze stinky cheese diaper");
cli_execute("fold loathing legion moondial");
if (have_familiar($familiar[Disembodied Hand]) = true && my_familiar() = !$familiar[disembodied hand]);
{
	use_familiar($familiar[disembodied hand]);
}
maximize("adv", false);

cli_execute("call 5 - HASTEBRO cleanup.ash");

Cleanup.ash isn't included in there because it's in my home PC and I'm inmy laptop right now, but I know that works already.
 
The CLI "squeeze" and "fold" commands are exactly the same, and there isn't any ASH equivalent.

Regarding the other questions, you seem to have the right answer to all of them.
 
Code:
## Will it buy the cheapest?
foreach it in $items[hot hi mein, cold hi mein, stinky hi mein, spooky hi mein, sleazy hi mein]
{
	min(mall_price(it, it);
	buy(3, it, 3500);
	eat(3, it);
}

That really won't work, let alone in the way you desire. I'll try to write something closer to your intention:

Code:
item [int] himein;
foreach it in $items[hot hi mein, cold hi mein, stinky hi mein, spooky hi mein, sleazy hi mein]
	himein [count(himein)] = it;
sort himein by mall_price(value);
buy(3, himein[0]);
eat(3, himein[0]);

I create an integer indexed map of items so that it can be sorted in order of current price with index 0 being the cheapest.
 
Last edited:
Wasn't there a way to do the sorting with cheapest? I seem to recall that, but can't remember how long ago that passed my eyes. :)
 
You could do:
PHP:
cli_execute( "cheapest hi mein; buy 3 it; eat 3 it" );
but "cheapest" doesn't have an ASH equivalent.
 
Last edited:
And if you want that hard limit of "not more than 3500", you'd need to get even more complicated. Meh. But yeah, that was it. :) Thanks.
 
Wouldn't each of these buy the limit 1 in the mall for the lowest mall price, and then buy the remaining 2 at whatever it is, so if there is 1 hot hi mein for 100, and then its 5000, but stinky hi mein is all 3000 it would spend 10100 rather than 6100?
 
mall_price() and "cheapest" return the price of the 5th item in the mall, so it will ignore min priced hi meins when choosing which one to buy. This means that, unless there are 5 min-priced hot hi meins, it will choose to buy the stinky hi mein.

Of course, when it actually buys, it will buy the 3 cheapest ones, including the min-priced ones.
 
Code:
> cheapest lasagna

Searching for "fishy fish lasagna"...
Search complete.
Searching for "gnat lasagna"...
Search complete.
Searching for "long pork lasagna"...
Search complete.
fishy fish lasagna @ 3,200
gnat lasagna @ 3,250
long pork lasagna @ 3,333

> buy 1 long pork lasagna

Using cached search results for long pork lasagna...
Purchasing long pork lasagna (1 @ 2,950)...
You acquire an item: long pork lasagna
Purchases complete.
It looks like it ignores the one @ 2950. "cheapest" and "expensive" both use StoreManager.getMallPrice( item ), just like mall_price(), whereas "searchmall" uses StoreManager.searchMall() directly, giving the same results as the Purchases tab.
 
Last edited:
Ok, I tested it and had some trouble with the familiar checks, but I worked it out, so no problems there.

What I do want to know now is how to add a session summary to the end of the script, I looked for that in the wiki for about an hour and didn't find it, so any tips?

Code:
if (my_inebriety() == 0)
{
	cli_execute("breakfast");
	foreach it in $items[cold wad, hot wad, stench wad, sleaze wad, spooky wad]
	{
		buy(3, it);
	}
	use_skill(3, $skill[rainbow gravitation]);

	cli_execute("csend 1 meat to HastyBuffer");
	cli_execute("csend 2 meat to HastyBuffer");
	cli_execute("csend 3 meat to HastyBuffer");
	cli_execute("wait 60");

	use(2, $item[Milk of Magnesium]);
	item [int] himein;
	foreach it in $items[hot hi mein, cold hi mein, stinky hi mein, spooky hi mein, sleazy hi mein]
		himein [count(himein)] = it;
	sort himein by mall_price(value);
	buy(3, himein[0]);
	eat(3, himein[0]);

	equip($item[brimstone beret]);
	use_skill(3, $skill[ode to booze]);
	drink(3, $item[cherrybomb]);
	drink(1, $item[pumpkin beer]);

	use(3, $item[agua de vida]);
	use(1, $item[prismatic wad]);
}

print("Consumption completed.", "blue");

if(my_adventures() >= 200 && my_inebriety() == 19)
{
	maximize("2.0 meat, 0.75 HP", false);
	if(available_amount($item[stinky cheese eye]) == 0)
	{
		cli_execute("squeeze stinky cheese eye");
		equip($slot[acc3], $item[stinky cheese eye]);
	}
	else
	{
		equip($slot[acc3], $item[stinky cheese eye]);
	}

	if (have_familiar($familiar[Obtuse Angel]) == true && my_familiar() != $familiar[Obtuse Angel])
	{
		use_familiar($familiar[Obtuse Angel]);
		equip($slot[familiar], $item[quake of arrows]);
		cli_execute("call aftercore.ash");
	}

	if (have_familiar($familiar[baby sandworm]) == true  && my_familiar() != $familiar[baby sandworm])
	{
		use_familiar($familiar[baby sandworm]);
		equip($slot[familiar], $item[Li'l Businessman Kit]);
		add_item_condition(5, $item[agua de vida]);
		adventure(my_adventures(), $location[Giant's Castle]);
		equip($slot[familiar], $item[none]);
	}
	
	if (have_familiar($familiar[rogue program]) == true  && my_familiar() != $familiar[rogue program])
	{
		use_familiar($familiar[rogue program]);
		equip($slot[familiar], $item[Li'l Businessman Kit]);
		add_item_condition(5, $item[game grid token]);
		adventure(my_adventures(), $location[Giant's Castle]);
		equip($slot[familiar], $item[none]);
	}
	
	if (have_familiar($familiar[llama lama]) == true && my_familiar() != $familiar[llama lama])
	{
		use_familiar($familiar[llama lama]);
		equip($slot[familiar], $item[Li'l Businessman Kit]);
		add_item_condition(5, $item[llama lama gong]);
		adventure(my_adventures(), $location[Giant's Castle]);
		equip($slot[familiar], $item[none]);
	}
	
	if (have_familiar($familiar[Li'l Xenomorph]) == true && my_familiar() != $familiar[Li'l Xenomorph])
	{
		use_familiar($familiar[Li'l Xenomorph]);
		equip($slot[familiar], $item[Li'l Businessman Kit]);
		add_item_condition(5, $item[transporter transponder]);
		adventure(my_adventures(), $location[Giant's Castle]);
		equip($slot[familiar], $item[none]);
	}
	
	if (have_familiar($familiar[hobo monkey]) == true && my_familiar() != $familiar[hobo monkey])
	{
		use_familiar($familiar[hobo monkey]);
		equip($slot[familiar], $item[Li'l Businessman Kit]);
		adventure(my_adventures(), $location[Giant's Castle]);
		equip($slot[familiar], $item[none]);
	}
}
	
print("Adventuring completed.", "blue");	
	
if(my_adventures() == 0 && my_inebriety() == 19)
{
	cli_execute("raffle 20");

	equip($item[brimstone beret]);

	use_skill(1, $skill[ode to booze]);
	drink(1, $item[cherry bomb]);

	cli_execute("squeeze stinky cheese diaper");
	cli_execute("fold loathing legion moondial");
	if (have_familiar($familiar[Disembodied Hand]) == true) ## && my_familiar() = !$familiar[disembodied hand]);
	{
		use_familiar($familiar[disembodied hand]);
	}
	maximize("adv", false);
}

print("Rollover Setup completed.", "blue");

if(my_inebriety() >= 20)
{
	batch_open();
		foreach it in $items[Game Grid Token,scrumptious reagent, dry noodles, little paper umbrella, coconut shell, magical ice cube, drink me potion, sugar sheet, pumpkin, llama lama gong, paint bomb, transporter transponder, d6, d8, d10, d12, d20, fish juice box]
		put_shop(max(mall_price(it) - 100, 4 * autosell_price(it)), 0, item_amount(it), it);
	batch_close();

	batch_open();
		item it = $item[Bricko Brick];
		int price = max(mall_price(it) - 10, 2 * autosell_price(it));  
		put_shop(price, 0, item_amount(it), it);
		
		item it2 = $item[agua de vida];
		int price2 = max(mall_price(it2) - 100, 4 * autosell_price(it2));
		int amount2 = max(item_amount(it2) - 3, 0);
		put_shop(price2, 0, amount2, it2);
		
		item it3 = $item[disassembled clover];
		int price3 = max(mall_price(it3) - 100, 4 * autosell_price(it3));
		int amount3 = max(item_amount(it3) - 100, 0);
		put_shop(price3, 0, amount3, it3);
		
		item it4 = $item[scratch 'n' sniff unicorn sticker];
		int price4 = max(mall_price(it4) - 100, 4 * autosell_price(it4));
		int amount4 = max(item_amount(it4) - 20, 0);
		put_shop(price4, 0, amount4, it4);
			
		item it5 = $item[scratch 'n' sniff UPC sticker];
		int price5 = max(mall_price(it5) - 100, 4 * autosell_price(it5));
		int amount5 = max(item_amount(it5) - 20, 0);
		put_shop(price, 0, amount5, it5);
		
		item it6 = $item[prismatic wad];
		int price6 = max(mall_price(it6) - 100, 4 * autosell_price(it6));
		int amount6 = max(item_amount(it6) - 1, 0);
		put_shop(price6, 0, amount6, it6);
		
		item it7 = $item[D4];
		int price7 = max(mall_price(it7) - 100, 4 * autosell_price(it7));
		int amount7 = max(item_amount(it7) - 100, 0);
		put_shop(price7, 0, amount7, it7);
	batch_close();

	batch_open();
		foreach itX in $items[heavy D, Original G, thin black candle, disturbing fanfic, furry fur, wolf mask, awful poetry journal, thin black candle, chaos butterfly, plot hole, probability potion, procrastination potion, Angry Farmer candy, giant needle, Mick's IcyVapoHotness Rub, rave whistle]
			autosell(item_amount(itX), itX);
	batch_close();
		
	item WSGC = $item[Warm Subject gift certificate];
	use (item_amount(WSGC), WSGC);

	batch_open();
	foreach stash in $items[black-and-blue light, blue plasma ball, cheap studded belt, flavored foot massage oil, foam dart, Loudmouth Larry Lamprey, personal massager, stick-on eyebrow piercing, personalized coffee mug, love song of disturbing obsession, love song of naughty innuendo, love song of smoldering passion, love song of sugary cuteness, 	love song of vague ambiguity, scratch 'n' sniff apple sticker, scratch 'n' sniff dragon sticker, scratch 'n' sniff rock band sticker, scratch 'n' sniff wrestler sticker]
		put_stash(item_amount(stash), stash);
	batch_close();
}

print("Cleanup completed.", "blue");

print("Today you did the following:(session summary goes here) Congrats!", "blue");
 
I use this trackitems alias to track item/meat changes.
alias trackitems => ashq int [item] currentinv = get_inventory(); int currentmeat = my_meat(); try{cli_execute("%%");}finally{ int [item] postinv = get_inventory(); int postmeat = my_meat(); foreach i2,c2 in postinv{if (postinv[i2] != currentinv[i2]) print(i2 + ": " + (postinv[i2].to_int() - currentinv[i2].to_int()));} foreach i1,c1 in currentinv{if (postinv[i1] == 0) print(i1 + ": " + (-c1));}if (postmeat != currentmeat) print("Meat: " + (postmeat - currentmeat));}
Just call the script with trackitems... like "trackitems farming" or whatever you call it. It uses try/finally so even if you have to abort out with escape, it'll still tell you how you made out.
 
Thanks Theraze, I added that to the script instead of using it as an alias, otherwise the item tracking wouldn't work since I do the cleanup at the end of my farming script.
 
Back
Top