Yet Another Meat/Item Farm

Right now, the heavy part of the script is getting on good gear. I used the KolWiki to decide what gear to choose from, http://kol.coldfront.net/thekolwiki/index.php/Maximizing_Your_Item_Drops and http://kol.coldfront.net/thekolwiki/index.php/Maximizing_Your_Meat_Drops
Its starts by checking in the 'Villa' section, working its way down the line. Please try it, and give some comments on what other gear I should add, and where (Put X item Before Y but after Z). The reason I say that is because it searches for Items like so,
If(Have Excellent item){
Equip it
}
else if(Have Good item){
Equip it
}
and so on... So placement is key.

Also, the adventuring part is nothing special, just use all turns at the castle. Eventually I will add something more complex/better, and will probably add in a put mall/put in closet/auto sell/trade to collectors function, so you can get rid of the items you pick up along the way.

Put both scripts in the same area. There is a config section of the MeatFarm script, probably a good idea to look at it.
 

Attachments

  • GT_Get_Buffs.ash
    2 KB · Views: 181
  • GT_MeatFarm.ash
    9.9 KB · Views: 253

macman104

Member
Why, if in the section where you call the various functions you check for torso, do you have all of the checks in the function as well? For both the torso and double-fisted, I think you would be better suited simply declaring 2 variables for each and setting them to true or false, instead of checking each time in your functions. Or, especially for the shirt one, before you go into all of your if statements, just do a blanket check, and if it's false, simply return from the function immediately.
Code:
boolean wearsShirts = have_skill($skill[Torso Awaregness]);
boolean doubleFists = have_skill($skill[Double-Fisted Skull Smashing]);
Also, I think you would love exploring how to use maps for this particular instance. Something like
Code:
int [item] bestHats;
bestHats[$item[plexiglass pith helmet]] = $item[plexiglass pith helmet].item_amount();
bestHats[$item[ice pick]] = $item[ice pick].item_amount();
bestHats[$item[miner's helmet]] = $item[miner's helmet].item_amount();

void Get_Best_Hat()
{
	hatSlot = $slot[hat];
	buyItem = $item[miner's helmet];  //This is the item we buy at the end of the loop
	foreach hat in bestHats
	{
		if(bestHats[item] > 0)
		{
			equip_slot(hatSlot, hat);
			return;
		}
	}
	//If we've still hit here, that means we didn't have anything, so buy whatever item we defined earlier
	buy(buyItem);
	equip_slot(hatSlot, buyItem);
}
Functionally, speed and memory wise, I'm not sure which is more efficient, but I think it'll improve readability alot, and also, it will make it much easier to add more items in the future.

For the shirt thing...
Code:
int [item] bestShirts;
bestShirts[$item[Ye Olde Navy Fleece]] = $item[Ye Olde Navy Fleece].item_amount();
bestShirts[$item[flaming pink shirt]] = $item[flaming pink shirt].item_amount();
bestShirts[$item[Grateful Undead T-Shirt]] = $item[Grateful Undead T-Shirt].item_amount();

void Get_Best_Shirt()
{
	if(!wearsShirts)
	{
		return;
	}
	shirtSlot = $slot[shirt];
	foreach shirt in bestShirts
	{
		if(bestShirts[shirt] > 0)
		{
			equip_slot(shirtSlot, shirt);
			print("Moving on...");
			return;
		}
	}
	print("Moving on...");
}
These first two functions don't have as many items, but for some of the later functions, especially the accessory one and such, they get really long, and the maps could really help improve that. Just some thoughts, and especially with NS-13, and tons of new items, maps may be even more of a help later on.

Hopefully you didn't feel like I tore apart your stuff too much. It all looks great and seems like it will function fine now, just thought I'd offer my opinion. If you can't tell, after learning more about maps, I've really come to love them.
 
Since I put so much effort into writing this script in the first place, I decided to try and revive it. So before I started adding new features (autoselling, getting drunk, etc...), I wanted to make the core of it work.

But I a having some trouble;

  • [li]Is there no longer an 'equip_slot()' function? How do equip items now?[/li]
    [li]How would I do a config section? It says I cannot assign a boolean to an integer...[/li]

There are probably other countless issues with it, just to get it up to speed with v. 11.7, just haven't found them all yet. Any help would be greatly appreciated!
 

Veracity

Developer
Staff member
[quote author=GhettoTrucker link=topic=970.msg5905#msg5905 date=1192675086]
How would I do a config section? It says I cannot assign a boolean to an integer...[/quote]

It's right. The solution is to assign boolean values to boolean variables, rather than integer variables.
Rather than:

int Double_Fisted = True;

use:

boolean Double_Fisted = True;

or better yet:

boolean Double_Fisted = have_skill( $skill[ Double-Fisted Skull Smashing ] );
 

hippymon

Member
Also, for the sake of simplification the familiar section would be easier done as:
Code:
###############################
#######GET_BEST_FAMILIAR#######
###############################
void Get_Best_Familiar(){
	if(have_familiar($familiar[Ninja Pirate Zombie Robot])){
		equip_familiar($familiar[Ninja Pirate Zombie Robot]);
}
	if(have_familiar($familiar[Leprechaun])){
		equip_familiar($familiar[Leprechaun]);
}
		else if(item_amount($item[plastic pumpkin bucket]) > 0){
		equip($item[plastic pumpkin bucket]);
}
		if(item_amount($item[lucky Tam O'Shanter]) > 0){
		equip($item[lucky Tam O'Shanter]);
}
		else if(item_amount($item[lucky Tam O'Shatner]) > 0){
		equip($item[lucky Tam O'Shatner]);
}
		else if(item_amount($item[miniature gravy-covered maypole]) > 0){
		equip($item[miniature gravy-covered maypole]);
}
		else if(item_amount($item[Mayflower bouquet]) > 0){
		equip($item[Mayflower bouquet]);
}
		else{
		equip($item(familiar_equipment(my_familiar())));
}
}
 
Thanks for all those comments. I added Hippymon's code for the get_best_familiar() function. I changed the config section. Redid how the script gets buffs...

I've attached the newest version of the script (we'll call 2.01 for the sake of argument). I have a few ideas I would like to implement but I can't mentally figure out the logic... Maybe someone else can help me with that.

I want to have in the main() a part at the begining that says,
if I don't have enough meat to pay for the buffs,
adventure at the knob goblin treasury until I have enough or more than enough,
get the buffs,
move on to adventuring at the castle.

Once I have the base for that I should be able to edit it for booze, food, etc...


Also, i am getting a mmysterious error from this current version. It says,
Code:
Undefined reference 'equip_slot' (GT_MeatFarm2.ash, line 91)
I don't see why it would be undefined, unless off-hand is no longer valid...
 

Attachments

  • GT_MeatFarm2.ash
    10.1 KB · Views: 53

hippymon

Member
As for the "equip_slot" simply change remove the "_slot"

Also, I am confused as to why you have
Code:
#Assign Get_Buffs to fals if you wish to not get buffed.
#Default: True
boolean Get_Buffs = True;
AND
Code:
#Get Buffs from buff bots?
#default: True
boolean recieveBuffs = True;
It appears as though the serve the same purpose....

And as for the buffs, does this version 2.01 discontinue the need for GT_Get_Buffs.ash? If so, replace this:
Code:
	if(my_meat() >= 2031){
	Get_Buffed();
	Wait(Wait_Time);
	}
With this:
Code:
	if(my_meat() < 2031){
		cli_execute("conditions clear");
		cli_execute("conditions add 2031 meat");
		adventure(my_adventures(), $location[Knob Goblin Treasury]);
}
	Get_Buffed();
	Wait(Wait_Time);

FYI: There are more problems you will run into but for the sake of your learning (if you wish) I won't tell you unless you need help.
 
I still need loads of help (The wiki is not much help unfortunately... :-\) Is tehre a page taht has all of the current usable functions? Also, what is hippymon's ingame name?
 
After long hours of work on this script, I think I have the core of the script functioning. The only problem I am having is that it is not recognizing "Castle in the Clouds in the Sky" as an adventure location. (Could it be because I have it defined as, string FarmLocation = $location[Castle in the Clouds in the Sky]; ?)

Anyway, here is the updated script. Hopefully I can get this working so that I can add all the new features I have planned.

Also, I think it is skipping the equip_best() and Get_Buffed() functions in the script (in the main() section). Well, here it is!


I also attached a file called reference.txt it has all the functions output from ashref (ashref output it all as a single line so I put it into a file and took the time adding a new line for every function... All 240 of them...) Hopefully someone else has a use for it like I do (easier to find stuff that in the gCli you can do a ctrl+f).
Enjoy!
 

Attachments

  • GT_MeatFarm2.ash
    10.4 KB · Views: 43
  • reference.txt
    6.9 KB · Views: 47

hippymon

Member
"Castle in the Clouds in the Sky" is now "Giant's Castle"... Simple fix.

If your not sure what something does or would like a more in-depth version of each function I have this page: http://www.wiki.kolmafia.us/index.php/User:ZammyWarrior it has a full list of MOST functions with descriptions of there purpose.
Also, with the familiar portion... Few problems:
Code:
###############################
#######GET_BEST_FAMILIAR#######
###############################
void Get_Best_Familiar(){
	if(have_familiar($familiar[Ninja Pirate Zombie Robot])){
		use_familiar($familiar[Ninja Pirate Zombie Robot]);
}
	else if(have_familiar($familiar[Leprechaun])){
		use_familiar($familiar[Leprechaun]);
}
		if(item_amount($item[plastic pumpkin bucket]) > 0){
		equip($item[plastic pumpkin bucket]);
}
		else if(item_amount($item[lucky Tam O'Shanter]) > 0){
		equip($item[lucky Tam O'Shanter]);
}
		else if(item_amount($item[lucky Tam O'Shatner]) > 0){
		equip($item[lucky Tam O'Shatner]);
}
		else if(item_amount($item[miniature gravy-covered maypole]) > 0){
		equip($item[miniature gravy-covered maypole]);
}
		else if(item_amount($item[Mayflower bouquet]) > 0){
		equip($item[Mayflower bouquet]);
}
		else{
		if(available_amount(familiar_equipment(my_familiar()))) == 0) retrieve_item(1, (familiar_equipment(my_familiar())));
			equip(familiar_equipment(my_familiar()));
}
}
Other than that I see no problems with the script. ;)
 

Veracity

Developer
Staff member
[quote author=GhettoTrucker link=topic=970.msg5919#msg5919 date=1192903994]
Could it be because I have it defined as, string FarmLocation = $location[Castle in the Clouds in the Sky]; ?)[/quote]

That is certainly incorrect. $location[ xxx ] is a "location" constant, not a "string". However, ASH automatically converts back and forth between the two for you, so it will still work - inefficiently.

I notice the following code:

Code:
	cli_execute("csent 1000 meat to IocaineBot ");
	cli_execute("csent 174 meat to IocaineBot ");
	cli_execute("csent 310 mear to IocaineBot ");

What is the "csent" command? And what is "310 mear"?

Also, I think it is skipping the equip_best() and Get_Buffed() functions in the script (in the main() section).

Yes. You have unbalanced braces. Your Get_Best_Accessories function never ends and therefore consumes the rest of the file. You might consider putting a close brace around line 226.

You also might try using a consistent indentation scheme that does NOT include having lines flush against the left margin unless they are starting or ending a function.

You also should consider making a single Get_Best_Accessory( slot ) function and calling it three times with the three slots, rather than duplicating lots and lots of code three times.
 
So I made those little corrections (have not tested yet, will edit post when I do). But Veracity is this how you meant?
Code:
void Get_Best_Accessory(int slot){
	if(item_amount($item[incredibly dense meat gem]) > 0){
		equip($slot[slot], $item[incredibly dense meat gem]);
	}
	else if(item_amount($item[Grimacite galoshes]) > 0){
		equip($slot [slot], $item[Grimacite galoshes]);
	}
	else if(item_amount($item[Grimacite gorget]) > 0){
		equip($slot[slot], $item[Grimacite gorget]);
	}
	else if(item_amount($item[Mr. Accessory Jr]) > 0){
		equip($slot[slot], $item[Mr. Accessory Jr]);
	}
	else if(item_amount($item[Jekyllin hide belt]) > 0){
		equip($slot[slot], $item[Jekyllin hide belt]);
	}
	else if(item_amount($item[ice skates]) > 0){
		equip($slot[slot], $item[ice skates]);
	}
	else if(item_amount($item[Baron Von Ratsworth's money clip]) > 0){
		equip($slot[slot], $item[Baron Von Ratsworth's money clip]);
	}
	else if(item_amount($item[evil flaming eyeball pendant]) > 0){
		equip($slot[slot], $item[evil flaming eyeball pendant]);
	}
	else if(item_amount($item[lucky rabbit's foot]) >0){
		equip($slot[slot], $item[lucky rabbit's foot]);
	}
	else if(item_amount($item[porquoise necklace]) > 0){
		equip($slot[slot], $item[porquoise necklace]);
	}
	else if(item_amount($item[Baron Von Ratsworth's monocle]) > 0){
		equip($slot[slot], $item[Baron Von Ratsworth's monocle]);
	}
}

And then call it like,
Get_Best_Accessory(acc1);
Get_Best_Accessory(acc2);
Get_Best_Accessory(acc3);

Would that work, or should I do something more fancy to increase efficiency?

Oh, also, side question is it ok if I do something like this;
Code:
#Where to get fast meat? In case you don't have enough to buy stuff.
#default: Knob Goblin Treasury
location BigMoney = $location[Knob Goblin Treasury]; 
#Where to farm?
#default: Castle in the Clouds in the Sky
location FarmLocation = $location[Giant's Castle];
...
....
...
		if(my_meat() < 2031){
			cli_execute("conditions clear");
			cli_execute("conditions add 2031 meat");
			adventure(my_adventures(), BigMoney);
		}
	}
	Get_Buffed();
	Wait(Wait_Time);
	if(my_adventures() > 0){
		adventure(my_adventures(), FarmLocation);
	}
That will work, right?
 

Veracity

Developer
Staff member
[quote author=GhettoTrucker link=topic=970.msg5923#msg5923 date=1192908855]
And then call it like,
Get_Best_Accessory(acc1);
Get_Best_Accessory(acc2);
Get_Best_Accessory(acc3);[/quote]

Not quite. You can't use $slot[ xxx ] where xxx is a variable.
You will want to define your function:

void Get_Best_Accessory( slot s )

get rid of all the $slot constants inside it, and call it like this:

Get_Best_Accessory( $slot[ acc1 ] );

Oh, also, side question is it ok if I do something like this
...
That will work, right?

You mean setting conditions and adventuring my_adventures() times? That should work.
 
Code:
void Get_Best_Accesories(slot s){
	if(item_amount($item[incredibly dense meat gem]) > 0){
		equip(s, $item[incredibly dense meat gem]);
	}
	else if(item_amount($item[Grimacite galoshes]) > 0){
		equip(s, $item[Grimacite galoshes]);
	}
	else if(item_amount($item[Grimacite gorget]) > 0){
		equip(s, $item[Grimacite gorget]);
	}
	else if(item_amount($item[Mr. Accessory Jr]) > 0){
		equip(s, $item[Mr. Accessory Jr]);
	}
	else if(item_amount($item[Jekyllin hide belt]) > 0){
		equip(s, $item[Jekyllin hide belt]);
	}
	else if(item_amount($item[ice skates]) > 0){
		equip(s, $item[ice skates]);
	}
	else if(item_amount($item[Baron Von Ratsworth's money clip]) > 0){
		equip(s, $item[Baron Von Ratsworth's money clip]);
	}
	else if(item_amount($item[evil flaming eyeball pendant]) > 0){
		equip(s, $item[evil flaming eyeball pendant]);
	}
	else if(item_amount($item[lucky rabbit's foot]) >0){
		equip(s, $item[lucky rabbit's foot]);
	}
	else if(item_amount($item[porquoise necklace]) > 0){
		equip(s, $item[porquoise necklace]);
	}
	else if(item_amount($item[Baron Von Ratsworth's monocle]) > 0){
		equip(s, $item[Baron Von Ratsworth's monocle]);
	}
}

Like that?
 

MagiNinjA

New member
[quote author=GhettoTrucker link=topic=970.msg5925#msg5925 date=1192909715]
Code:
void Get_Best_Accesories(slot s){
	if(item_amount($item[incredibly dense meat gem]) > 0){
		equip(s, $item[incredibly dense meat gem]);
	}
	else if(item_amount($item[Grimacite galoshes]) > 0){
		equip(s, $item[Grimacite galoshes]);
	}
	else if(item_amount($item[Grimacite gorget]) > 0){
		equip(s, $item[Grimacite gorget]);
	}
	else if(item_amount($item[Mr. Accessory Jr]) > 0){
		equip(s, $item[Mr. Accessory Jr]);
	}
	else if(item_amount($item[Jekyllin hide belt]) > 0){
		equip(s, $item[Jekyllin hide belt]);
	}
	else if(item_amount($item[ice skates]) > 0){
		equip(s, $item[ice skates]);
	}
	else if(item_amount($item[Baron Von Ratsworth's money clip]) > 0){
		equip(s, $item[Baron Von Ratsworth's money clip]);
	}
	else if(item_amount($item[evil flaming eyeball pendant]) > 0){
		equip(s, $item[evil flaming eyeball pendant]);
	}
	else if(item_amount($item[lucky rabbit's foot]) >0){
		equip(s, $item[lucky rabbit's foot]);
	}
	else if(item_amount($item[porquoise necklace]) > 0){
		equip(s, $item[porquoise necklace]);
	}
	else if(item_amount($item[Baron Von Ratsworth's monocle]) > 0){
		equip(s, $item[Baron Von Ratsworth's monocle]);
	}
}
[/quote]

Something easier (IMO) and can be used very flexibly...the for loop! (and well, its brother foreach)

To recode this into less lines, I'd do:

Code:
void Get_Best_Accessories(slot s)
{
	item[int] acc;
	acc[ 1] = $item[incredibly dense meat gem];
	acc[ 2] = $item[Grimacite galoshes];
	acc[ 3] = $item[Grimacite gorget];
	acc[ 4] = $item[Mr. Accessory Jr];
	acc[ 5] = $item[Jekyllin hide belt];
	acc[ 6] = $item[ice skates];
	acc[ 7] = $item[baron von ratworth's money clip];
	acc[ 8] = $item[evil flaming eyeball pendant];
	acc[ 9] = $item[lucky rabbit's foot];
	acc[10] = $item[porquoise necklace];
	acc[11] = $item[baron von ratworth's monocle];

	foreach i in acc
	{
		if (item_amount(acc[i]) > 0)
		{ equip(s, acc[i]); }
	}
}

Also, how'd you manage to do the tabs in the code tag? I copied the tab space from GT's post. >.>
 

Veracity

Developer
Staff member
[quote author=MagiNinjA link=topic=970.msg5951#msg5951 date=1193298795]
To recode this into less lines, I'd do:
...[/quote]
Some comments:

1) Your proposal is not quite the equivalent. Notice that he had an if...then...else if chain - it quit after the first accessory equipped in a slot.

2) I would put the map at top-level (global) so it gets initialized once, not every time the function is called.

3) He has the accessories ordered by "goodness". So do you - 1 through 11. However, although foreach is guaranteed to get every entry in the map, it is not guaranteed to get them in the same order they were inserted. It MIGHT get them from 1 to 11, but I don't think you can guarantee it.

Try this:

Code:
item [int] acc;
acc[ 1] = $item[incredibly dense meat gem];
acc[ 2] = $item[Grimacite galoshes];
acc[ 3] = $item[Grimacite gorget];
acc[ 4] = $item[Mr. Accessory Jr];
acc[ 5] = $item[Jekyllin hide belt];
acc[ 6] = $item[ice skates];
acc[ 7] = $item[baron von ratworth's money clip];
acc[ 8] = $item[evil flaming eyeball pendant];
acc[ 9] = $item[lucky rabbit's foot];
acc[10] = $item[porquoise necklace];
acc[11] = $item[baron von ratworth's monocle];

void Get_Best_Accessories(slot s)
{
	for i from 1 to count(acc)
	{
		if ( item_amount (acc[i] ) > 0 )
		{
			equip( s, acc[i]) ;
			return;
		}
	}
}
 

macman104

Member
[quote author=Veracity link=topic=970.msg5955#msg5955 date=1193319188]

Some comments:

3) He has the accessories ordered by "goodness". So do you - 1 through 11. However, although foreach is guaranteed to get every entry in the map, it is not guaranteed to get them in the same order they were inserted. It MIGHT get them from 1 to 11, but I don't think you can guarantee it.[/quote]O.O, that's good to know, I wasn't aware of that...
 
Top