Meat Manager for the Paranoid

macman104

Member
Hey, so for those of you that have a large chunk of meat, and don't like broadcasting that to the world, here's a nifty little script for you. The script will prompt you for two values, your lbound and ubound. Lbound is the lowest amount of meat you want on hand, and ubound is the highest amount of meat you want on hand.
*NOTE: Your lower bound cannot be greater than or equal to your upper bound. Well it can, but the script yells at you, and then quits.
Code:
void main(int lbound, int ubound)
{
	if(lbound >= ubound)
	{
		print("Your upper bound cannot be lower than your lower bound, try again");
		return;
	}
	print("Remaining meat will be between " + lbound + " and " + ubound);
	print("Removing all closet meat...");
	take_closet(my_closetmeat());
	int rand = lbound + random(ubound - lbound);
	print("First number is: " + rand);
	print("Rand was acceptable, transferring all but " + rand + " meat to the closet...");
	put_closet(my_meat() - rand);
	print("Transfer complete");
	print("There is: " + my_closetmeat() + " meat in the closet");
	print("There is: " + my_meat() + " meat remaining on-hand.");
	print("Thank you!");
}
If you have any questions let me know.
 

Tirian

Member
Just as a quick observation, rand = lbound + random( ubound - lbound ) would save you from that while loop.
 

macman104

Member
[quote author=Tirian link=topic=365.msg2004#msg2004 date=1156179242]
Just as a quick observation, rand = lbound + random( ubound - lbound ) would save you from that while loop.
[/quote]Oo, very good. I like that.

Btw, there wasn't really a good place to put this, which is why it's in this section.

I wanted to add, that I really like the ability to prompt, and it's a very nice feature if you aren't familiar with it. Mafia will prompt for any variables that are passed to your "void main()" function.
 
Top