All Purpose Bitchin' Meat Car

macman104

Member
Okay, well I've tried to make this script as full proof as possible, adding in meat checks, zodiac checks, and adventure checks and the like. Yea, I'm overly obsessive, and this is probably wayyyy overkill, but deal... let me know if you see any gaps, I HAVE YET TO TEST THIS!!!!

BTW, I made it its own function, because I'm compiling a quest script, so I wanted to be able to just plop that first part in as its own function, it'll run by itself, but if it pleases you, you can just take out the main function, and change "GetMeatCar" to "main".

EDIT: Code revamp courtesy of Muffins. Post here
 
Not so much a gap, just an alternate way to do this:

Code:
print("Whaddya doing, you've already got a meatcar!");
abort;

Could be replaced with:

Code:
 cli_execute( "abort Whaddya doing, you've already got a meatcar!");

Also, while it may work perfectly fine... My Pascal mind tells me that GatherMeat should physically come before GetMeatCar. (I am used to any functions having to be defined before you can call them.


Code:
while(item_amount($item[worthless gewgaw]) + item_amount($item[worthless knick-knack]) + item_amount($item[worthless trinket]) < 1

That is a damn neat way to check for at least one of a set of items. I'll have to test this to make sure it works, but very slick.

Code:
if(conditionsmet == true)
{
create(1, 4item[bitching' meatcar]);

Typo, the 4 should be a $.



Otherwise, it looks great.
 

macman104

Member
True, I think GatherMeat should come before GetMeatCar. I like print better, can abort be used without cli_execute, or is it a standard scripting thing.

You can thank cjswimmer's SewerFun function for the way to check for a set, its in the auto ascension script.

Typo fixed in first post, and relinked.
 

Nightmist

Member
[quote author=Presto Ragu link=topic=49.msg152#msg152 date=1144124990]
Code:
while(item_amount($item[worthless gewgaw]) + item_amount($item[worthless knick-knack]) + item_amount($item[worthless trinket]) < 1

That is a damn neat way to check for at least one of a set of items. I'll have to test this to make sure it works, but very slick.[/quote]

It should work, my own "Get items from hermit" script uses the same thing.
 

macman104

Member
[quote author=arrggg link=topic=49.msg609#msg609 date=1146592903]
I get the error message:
Cannot apply int to bitchin' meatcar at line 3 in file
[/quote]Fixed, sorry I forgot a close parenthesis

EDIT: Hang on a little, with the new validate function, I'll make sure there are no other errors, I'll update this post once I've fixed everything.

EDIT^2: Alright, turns out there were quite a few typos, but I've uploaded the newest version, and it should all work out ok.
 

Tirian

Member
The location names changed with the release of KoLmafia 7.2. You could fix that yourself by popping into this ash file, searching for "Market Sewer (Unlucky)", and replacing it with "Unlucky Sewer".
 

macman104

Member
[quote author=jim link=topic=49.msg797#msg797 date=1147528048]
With the fix it worked perfectly.

[/quote]Glad to hear, if you have any suggestions for improvement, or anything you'd like to see added, let me know, otherwise, I consider this script to be complete.
 

Jaxia

New member
Thanks for sharing your script! A couple of things...

I just downloaded it, but I still got a copy that didn't have the Unlucky Sewer fixed. I edited the file, and ran it again. This time I got an error that said I ran out of adventures and to try again tomorrow. I still have 92 adventures and a couple thousand meat. The kicker? It really did create the car.

Just thought I'd let you know.
Thanks again!
 

muffins

Member
I made a few small changes, thanks to some new functions that have been introduced since this script was originally written.

Mainly just replaced the "SignType" check with the boolean in_muscle_sign(), threw in a visit to the guild character after the GetMeatCar function, and wrapped it in a contains_text/visit_url check for the beach. Also, if you have the beach unlocked, it will let you know (AND untinker your meatcar if you still have it)!

I just ran it on my hardcore character (err, who is out of adventures and has already unlocked the beach), and it gave the proper message. I won't be able to test the creation for a few more days. I may make a few more changes before then, such as a stat check to make sure you are high enough level to have gotten the quest, and a quest log check to see if you do or do not have the quest in the first place, and if not, go ahead and attempt the challenge(s)... buuut I probably won't for a while, because I'm lazy. :p

Code:
boolean GatherMeat(int MeatNeeded)
{
	if(in_muscle_sign())
	{
		while(my_meat() < MeatNeeded && my_adventures() > 0)
		{
			adventure(1, $location[Outskirts of The Knob]);
		}
	}
	
	else
	{
		while(my_meat() < MeatNeeded && my_adventures() > 0)
		{
			adventure(1, $location[Degrassi Knoll]);
		}
	}
	
	if(my_meat() >= MeatNeeded)
	{
		return true;
	}
	
	else
	{
		return false;
	}
}

void GetMeatCar()
{
	if(item_amount($item[bitchin' meatcar]) > 0)
	{
		print("Whaddya doing, you've already got a meatcar!");
		cli_execute("abort");
	}

	boolean conditionsmet;
	conditionsmet = false;

	if(in_muscle_sign())
	{
		if(my_meat() >= 108)
		{
			buy(1, $item[spring]);
			buy(1, $item[sprocket]);
			buy(1, $item[cog]);
			buy(1, $item[empty meat tank]);
			buy(1, $item[tires]);
		}
		
		else
		{
			while(my_meat() < 108 && my_adventures() > 0)
			{
				conditionsmet = GatherMeat(108);
			}
			
			if(conditionsmet == true)
			{
				buy(1, $item[spring]);
				buy(1, $item[sprocket]);
				buy(1, $item[cog]);
				buy(1, $item[empty meat tank]);
				buy(1, $item[tires]);
				conditionsmet = false;
			}
		}
	}
	
	else
	{
		int ToolboxCount;
		while(item_amount($item[spring]) == 0 || item_amount($item[sprocket]) == 0 || item_amount($item[cog]) == 0 || item_amount($item[empty meat tank]) == 0 || item_amount($item[tires]) == 0 && my_adventures() > 0)
		{
			adventure(1, $location[Degrassi Knoll]);
			while(item_amount($item[Gnollish toolbox]) > 0)
			{
				use(1, $item[Gnollish toolbox]);
			}
		}
	}

	while(item_amount($item[worthless gewgaw]) + item_amount($item[worthless knick-knack]) + item_amount($item[worthless trinket]) < 1 && my_adventures() > 0)
	{
		if(my_meat() >= 30)
		{
			conditionsmet = true;
		}
		
		else
		{
			conditionsmet = GatherMeat(30);
		}

		if(item_amount($item[chewing gum on a string]) < 1 && my_meat() >= 30 && conditionsmet == true && my_adventures() > 0)
		{ 
			buy(1, $item[chewing gum on a string]);
			adventure(1, $location[Unlucky Sewer] );
			conditionsmet = false;
		}
	}
	
	conditionsmet = false;

	if(item_amount($item[worthless gewgaw]) + item_amount($item[worthless knick-knack]) + item_amount($item[worthless trinket]) > 0)
	{
		if(my_meat() >= 100)
		{
			conditionsmet = true;
		}
		
		else
		{
			conditionsmet = GatherMeat(100);
		}
	}
	
	if(conditionsmet == true)
	{
		trade_hermit(1, $item[sweet rims]);
		conditionsmet = false;		
	}
	
	if(in_muscle_sign())
	{
		create(1, $item[bitchin' meatcar]);
	}
	
	else
	{
		if(my_meat() >= 160)
		{
			create(1, $item[bitchin' meatcar]);
		}
		
		else
		{
			conditionsmet = GatherMeat(160);
		}
		
		if(conditionsmet == true)
		{
			create(1, $item[bitchin' meatcar]);
		}
		
		else
		{
			print("Failed to create a bitchin' meatcar for ya, looks like you ran outta adventures :(  Try again tommorrow.");
		}
	}
}

void main()
{
	if(!contains_text(visit_url("main.php"),"beach.php")) {
		GetMeatCar();
		visit_url("guild.php?place=paco");
	}
	if(contains_text(visit_url("main.php"),"beach.php")) {
		if(item_amount($item[bitchin' meatcar]) > 0) {
			cli_execute("untinker bitchin' meatcar");
			print("You've already unlocked the beach! Your meatcar has been untinkered.");
		}
		else {
			print("You've already unlocked the beach! You have no meatcar to untinker.");
		}
	}
	
}
 

macman104

Member
Thanks Muffins. I've lost all of my scripts in a HD crash, and I've been too busy lately to code. Hopefully in the summer, I'll be able to get back into things a little bit more. So I appreciate you goin' through and reworkin' it.
 

muffins

Member
Ran it today on my hardcorer, who is under a muscle sign. Initially, it failed when it hit the sewer because I had conditions left over from another area, but good thing it did, 'cause it alerted me to a possible problem when I ran it again. It had already purchased the parts from the Knoll, but it purchased them again, so I added an item_amount check for those, as well as for the chewing gum, which you had a buy entry for (I'm not sure if that actually needs to be there... is chewing gum counted as a satisfied from NPC store purchase, or is it just a "duh, you need chewing gum for the sewer regardless, so it will always buy it"?)... oh, and I added a "conditions clear" at the beginning, too! :p

Nothing else to test it on (i.e., non-muscle sign)... sooo, that should be about it for now. Oh, and after completing the quest at the guild, it went ahead and checked for the beach and untinkered the car, too, so that works! :D
 

Attachments

  • bitchin.ash
    3.8 KB · Views: 122

Bellae

New member
NOt sure what I am missing. Downloaded the script. Tried to run it. I get no available namespace with functions: conditions.
???

What do I need to do to run these scripts? I have mafia 11.0 loaded.
 

macman104

Member
[quote author=Bellae link=topic=49.msg4872#msg4872 date=1182040514]
NOt sure what I am missing. Downloaded the script. Tried to run it. I get no available namespace with functions: conditions.
???

What do I need to do to run these scripts? I have mafia 11.0 loaded.
[/quote]When you download the script, it needs to be saved with a .ash extension. Are you doing that? Did you download the script that is posted right above you? If so, there is one other error in there, I've posted a redone script, with one change. (The function hermit_trade got changed to hermit()).
 

Attachments

  • bitchin.ash
    3.8 KB · Views: 116
Top