Could someone help me clean up this script?

Okay, it checks if I have a bartender, buys or pulls my drinks.
and buys or pulls my food.
Then drinks and eats.
However, it's really long and it was the only way I knew how to do it.
Any help on general clean up/shortcuts/ anything to make it more manageable would be great.


Code:
# item list
item hhm = $item[hot hi mein];
item slhm = $item[sleazy hi mein];
item sphm = $item[spooky hi mein];
item mt = $item[Mon Tiki];
item l = $item[lime];
item g = $item[grog];
item gt = $item[grogtini];
item mw = $item[Mae West];
item jo = $item[jumbo olive];
item dvm = $item[dry vodka martini];
item v = $item[vesper];
item ybr = $item[yellow brick road];
item c = $item[cherry];
item s = $item[sangria];
item sdd = $item[sangria del diablo];
item bitb = $item[bartender-in-the-box];
#
#So my other characters don't use this script.
#
if(my_name() == "Duffkiligan"){
	if(!have_bartender()){
		print("Getting a bartender");
		if(item_amount(bitb) >= 1){
			use(1, bitb);
		}
		else if(item_amount(bitb) == 0 && can_interact()){
			buy(1, bitb);
		}
		else if(item_amount(bitb) == 0){
			take_storage(1, bitb);
		}
		else{
			print("Could not get bartender");
			cli_execute("abort");
		}
	}
	else if(have_bartender()){
		print("Yay! Bartender!");
	}

#Getting the Booze you want.
    if(my_level() < 6){
    	print("Too low of a level to get booze.");
    }
    else if(my_inebriety() >= 2){
    	print("You're too drunk to drink your drinks. Get a soberness pill.");
    }
    else if(!have_skill($skill[Liver of steel])){
    	print("You don't have you're liver of steel, why get overdrunk?");
    }
	else if(my_level() >= 6 && my_inebriety() <= 1 && have_skill($skill[Liver of steel])){
    	print("Getting Booze");
#To buy them instead of pulling them out of ronin, obviously you won't pull if you're not in ronin.
		if(can_interact()){
        	if(my_primestat() == $stat[muscle]){
				if(item_amount(mt) == 0 && item_amount(l) == 0 && item_amount(g) == 0){
	            	buy(3, mt);
              		buy(1, l);
             		buy(1, g);
				}
				else if(item_amount(mt) == 1 && item_amount(l) == 0 && item_amount(g) == 0){
	            	buy(2, mt);
              		buy(1, l);
             		buy(1, g);
				}
				else if(item_amount(mt) == 2 && item_amount(l) == 0 && item_amount(g) == 0){
	            	buy(1, mt);
              		buy(1, l);
             		buy(1, g);
				}
				else if(item_amount(mt) >= 3 && item_amount(l) == 0 && item_amount(g) == 0){
              		buy(1, l);
             		buy(1, g);
				}
				else if(item_amount(mt) == 0 && item_amount(l) >= 1 && item_amount(g) == 0){
	            	buy(3, mt);
             		buy(1, g);
				}
				else if(item_amount(mt) == 0 && item_amount(l) == 0 && item_amount(g) >= 1){
	            	buy(3, mt);
              		buy(1, l);
				}
				else if(item_amount(mt) == 1 && item_amount(l) >= 1 && item_amount(g) == 0){
	            	buy(2, mt);
					buy(1, g);
				}
				else if(item_amount(mt) == 2 && item_amount(l) >= 1 && item_amount(g) == 0){
	            	buy(1, mt);
             		buy(1, g);
				}
				else if(item_amount(mt) >= 3 && item_amount(l) >= 1 && item_amount(g) == 0){
             		buy(1, g);
				}
				else if(item_amount(mt) == 1 && item_amount(l) == 0 && item_amount(g) >= 1){
	            	buy(2, mt);
              		buy(1, l);
				}
				else if(item_amount(mt) == 2 && item_amount(l) == 0 && item_amount(g) >= 1){
	            	buy(1, mt);
              		buy(1, l);
				}
				else if(item_amount(mt) >= 3 && item_amount(l) == 0 && item_amount(g) >= 1){
              		buy(1, l);
				}
				else if(item_amount(mt) == 0 && item_amount(l) >= 1 && item_amount(g) >= 1){
	            	buy(3, mt);
				}
				else if(item_amount(mt) == 1 && item_amount(l) >= 1 && item_amount(g) >= 1){
	            	buy(2, mt);
				}
				else if(item_amount(mt) == 2 && item_amount(l) >= 1 && item_amount(g) >= 1){
	            	buy(1, mt);
				}
				else if(item_amount(mt) >= 3 && item_amount(l) >= 1 && item_amount(g) >= 1){
	            	print("You have all of your drinks.");
				}
				else{
					print("Something went wrong, line 119.");
				}
            }
            else if(my_primestat() == $stat[moxie]){
            	if(item_amount(mw) == 0 && item_amount(jo) == 0 && item_amount(dvm) == 0){
	            	buy(3, mw);
              		buy(1, jo);
             		buy(1, dvm);
				}
				else if(item_amount(mw) == 1 && item_amount(jo) == 0 && item_amount(dvm) == 0){
	            	buy(2, mw);
              		buy(1, jo);
             		buy(1, dvm);
				}
				else if(item_amount(mw) == 2 && item_amount(jo) == 0 && item_amount(dvm) == 0){
	            	buy(1, mw);
              		buy(1, jo);
             		buy(1, dvm);
				}
				else if(item_amount(mw) >= 3 && item_amount(jo) == 0 && item_amount(dvm) == 0){
              		buy(1, jo);
             		buy(1, dvm);
				}
				else if(item_amount(mw) == 0 && item_amount(jo) >= 1 && item_amount(dvm) == 0){
	            	buy(3, mw);
             		buy(1, dvm);
				}
				else if(item_amount(mw) == 0 && item_amount(jo) == 0 && item_amount(dvm) >= 1){
	            	buy(3, mw);
              		buy(1, jo);
				}
				else if(item_amount(mw) == 1 && item_amount(jo) >= 1 && item_amount(dvm) == 0){
	            	buy(2, mw);
					buy(1, dvm);
				}
				else if(item_amount(mw) == 2 && item_amount(jo) >= 1 && item_amount(dvm) == 0){
	            	buy(1, mw);
             		buy(1, dvm);
				}
				else if(item_amount(mw) >= 3 && item_amount(jo) >= 1 && item_amount(dvm) == 0){
             		buy(1, dvm);
				}
				else if(item_amount(mw) == 1 && item_amount(jo) == 0 && item_amount(dvm) >= 1){
	            	buy(2, mw);
              		buy(1, jo);
				}
				else if(item_amount(mw) == 2 && item_amount(jo) == 0 && item_amount(dvm) >= 1){
	            	buy(1, mw);
              		buy(1, jo);
				}
				else if(item_amount(mw) >= 3 && item_amount(jo) == 0 && item_amount(dvm) >= 1){
              		buy(1, jo);
				}
				else if(item_amount(mw) == 0 && item_amount(jo) >= 1 && item_amount(dvm) >= 1){
	            	buy(3, mw);
				}
				else if(item_amount(mw) == 1 && item_amount(jo) >= 1 && item_amount(dvm) >= 1){
	            	buy(2, mw);
				}
				else if(item_amount(mw) == 2 && item_amount(jo) >= 1 && item_amount(dvm) >= 1){
	            	buy(1, mw);
				}
				else if(item_amount(mw) >= 3 && item_amount(jo) >= 1 && item_amount(dvm) >= 1){
	            	print("You have all of your drinks.");
				}
				else{
					print("Something went wrong, line 185.");
				}
            }
            else if(my_primestat() == $stat[mysticality]){
				if(item_amount(ybr) == 0 && item_amount(c) == 0 && item_amount(s) == 0){
	            	buy(3, ybr);
              		buy(1, c);
             		buy(1, s);
				}
				else if(item_amount(ybr) == 1 && item_amount(c) == 0 && item_amount(s) == 0){
	            	buy(2, ybr);
              		buy(1, c);
             		buy(1, s);
				}
				else if(item_amount(ybr) == 2 && item_amount(c) == 0 && item_amount(s) == 0){
	            	buy(1, ybr);
              		buy(1, c);
             		buy(1, s);
				}
				else if(item_amount(ybr) >= 3 && item_amount(c) == 0 && item_amount(s) == 0){
              		buy(1, c);
             		buy(1, s);
				}
				else if(item_amount(ybr) == 0 && item_amount(c) >= 1 && item_amount(s) == 0){
	            	buy(3, ybr);
             		buy(1, s);
				}
				else if(item_amount(ybr) == 0 && item_amount(c) == 0 && item_amount(s) >= 1){
	            	buy(3, ybr);
              		buy(1, c);
				}
				else if(item_amount(ybr) == 1 && item_amount(c) >= 1 && item_amount(s) == 0){
	            	buy(2, ybr);
					buy(1, s);
				}
				else if(item_amount(ybr) == 2 && item_amount(c) >= 1 && item_amount(s) == 0){
	            	buy(1, ybr);
             		buy(1, s);
				}
				else if(item_amount(ybr) >= 3 && item_amount(c) >= 1 && item_amount(s) == 0){
             		buy(1, s);
				}
				else if(item_amount(ybr) == 1 && item_amount(c) == 0 && item_amount(s) >= 1){
	            	buy(2, ybr);
              		buy(1, c);
				}
				else if(item_amount(ybr) == 2 && item_amount(c) == 0 && item_amount(s) >= 1){
	            	buy(1, ybr);
              		buy(1, c);
				}
				else if(item_amount(ybr) >= 3 && item_amount(c) == 0 && item_amount(s) >= 1){
              		buy(1, c);
				}
				else if(item_amount(ybr) == 0 && item_amount(c) >= 1 && item_amount(s) >= 1){
	            	buy(3, ybr);
				}
				else if(item_amount(ybr) == 1 && item_amount(c) >= 1 && item_amount(s) >= 1){
	            	buy(2, ybr);
				}
				else if(item_amount(ybr) == 2 && item_amount(c) >= 1 && item_amount(s) >= 1){
	            	buy(1, ybr);
				}
				else if(item_amount(ybr) >= 3 && item_amount(c) >= 1 && item_amount(s) >= 1){
	            	print("You have all of your drinks.");
				}
				else{
					print("Something went wrong, line 251.");
				}
            }
            else{
            	print("WHAT?! You don't have a Main Stat? Are you an astral spirit?");
            }
		}
        else{
#To pull from storage if you couldn't buy the drinks.
        	 if(my_primestat() == $stat[muscle]){
            	if(item_amount(mt) == 0 && item_amount(l) == 0 && item_amount(g) == 0){
	            	take_storage(3, mt);
              		take_storage(1, l);
             		take_storage(1, g);
				}
				else if(item_amount(mt) == 1 && item_amount(l) == 0 && item_amount(g) == 0){
	            	take_storage(2, mt);
              		take_storage(1, l);
             		take_storage(1, g);
				}
				else if(item_amount(mt) == 2 && item_amount(l) == 0 && item_amount(g) == 0){
	            	take_storage(1, mt);
              		take_storage(1, l);
             		take_storage(1, g);
				}
				else if(item_amount(mt) >= 3 && item_amount(l) == 0 && item_amount(g) == 0){
              		take_storage(1, l);
             		take_storage(1, g);
				}
				else if(item_amount(mt) == 0 && item_amount(l) >= 1 && item_amount(g) == 0){
	            	take_storage(3, mt);
             		take_storage(1, g);
				}
				else if(item_amount(mt) == 0 && item_amount(l) == 0 && item_amount(g) >= 1){
	            	take_storage(3, mt);
              		take_storage(1, l);
				}
				else if(item_amount(mt) == 1 && item_amount(l) >= 1 && item_amount(g) == 0){
	            	take_storage(2, mt);
					take_storage(1, g);
				}
				else if(item_amount(mt) == 2 && item_amount(l) >= 1 && item_amount(g) == 0){
	            	take_storage(1, mt);
             		take_storage(1, g);
				}
				else if(item_amount(mt) >= 3 && item_amount(l) >= 1 && item_amount(g) == 0){
             		take_storage(1, g);
				}
				else if(item_amount(mt) == 1 && item_amount(l) == 0 && item_amount(g) >= 1){
	            	take_storage(2, mt);
              		take_storage(1, l);
				}
				else if(item_amount(mt) == 2 && item_amount(l) == 0 && item_amount(g) >= 1){
	            	take_storage(1, mt);
              		take_storage(1, l);
				}
				else if(item_amount(mt) >= 3 && item_amount(l) == 0 && item_amount(g) >= 1){
              		take_storage(1, l);
				}
				else if(item_amount(mt) == 0 && item_amount(l) >= 1 && item_amount(g) >= 1){
	            	take_storage(3, mt);
				}
				else if(item_amount(mt) == 1 && item_amount(l) >= 1 && item_amount(g) >= 1){
	            	take_storage(2, mt);
				}
				else if(item_amount(mt) == 2 && item_amount(l) >= 1 && item_amount(g) >= 1){
	            	take_storage(1, mt);
				}
				else if(item_amount(mt) >= 3 && item_amount(l) >= 1 && item_amount(g) >= 1){
	            	print("You have all of your drinks.");
				}
				else{
					print("Something went wrong, line 323.");
				}
            }
            }
            else if(my_primestat() == $stat[moxie]){
            	if(item_amount(mw) == 0 && item_amount(jo) == 0 && item_amount(dvm) == 0){
	            	take_storage(3, mw);
              		take_storage(1, jo);
             		take_storage(1, dvm);
				}
				else if(item_amount(mw) == 1 && item_amount(jo) == 0 && item_amount(dvm) == 0){
	            	take_storage(2, mw);
              		take_storage(1, jo);
             		take_storage(1, dvm);
				}
				else if(item_amount(mw) == 2 && item_amount(jo) == 0 && item_amount(dvm) == 0){
	            	take_storage(1, mw);
              		take_storage(1, jo);
             		take_storage(1, dvm);
				}
				else if(item_amount(mw) >= 3 && item_amount(jo) == 0 && item_amount(dvm) == 0){
              		take_storage(1, jo);
             		take_storage(1, dvm);
				}
				else if(item_amount(mw) == 0 && item_amount(jo) >= 1 && item_amount(dvm) == 0){
	            	take_storage(3, mw);
             		take_storage(1, dvm);
				}
				else if(item_amount(mw) == 0 && item_amount(jo) == 0 && item_amount(dvm) >= 1){
	            	take_storage(3, mw);
              		take_storage(1, jo);
				}
				else if(item_amount(mw) == 1 && item_amount(jo) >= 1 && item_amount(dvm) == 0){
	            	take_storage(2, mw);
					take_storage(1, dvm);
				}
				else if(item_amount(mw) == 2 && item_amount(jo) >= 1 && item_amount(dvm) == 0){
	            	take_storage(1, mw);
             		take_storage(1, dvm);
				}
				else if(item_amount(mw) >= 3 && item_amount(jo) >= 1 && item_amount(dvm) == 0){
             		take_storage(1, dvm);
				}
				else if(item_amount(mw) == 1 && item_amount(jo) == 0 && item_amount(dvm) >= 1){
	            	take_storage(2, mw);
              		take_storage(1, jo);
				}
				else if(item_amount(mw) == 2 && item_amount(jo) == 0 && item_amount(dvm) >= 1){
	            	take_storage(1, mw);
              		take_storage(1, jo);
				}
				else if(item_amount(mw) >= 3 && item_amount(jo) == 0 && item_amount(dvm) >= 1){
              		take_storage(1, jo);
				}
				else if(item_amount(mw) == 0 && item_amount(jo) >= 1 && item_amount(dvm) >= 1){
	            	take_storage(3, mw);
				}
				else if(item_amount(mw) == 1 && item_amount(jo) >= 1 && item_amount(dvm) >= 1){
	            	take_storage(2, mw);
				}
				else if(item_amount(mw) == 2 && item_amount(jo) >= 1 && item_amount(dvm) >= 1){
	            	take_storage(1, mw);
				}
				else if(item_amount(mw) >= 3 && item_amount(jo) >= 1 && item_amount(dvm) >= 1){
	            	print("You have all of your drinks.");
				}
				else{
					print("Something went wrong, line 390.");
				}
            }
            else if(my_primestat() == $stat[mysticality]){
            	if(item_amount(ybr) == 0 && item_amount(c) == 0 && item_amount(s) == 0){
	            	take_storage(3, ybr);
              		take_storage(1, c);
             		take_storage(1, s);
				}
				else if(item_amount(ybr) == 1 && item_amount(c) == 0 && item_amount(s) == 0){
	            	take_storage(2, ybr);
              		take_storage(1, c);
             		take_storage(1, s);
				}
				else if(item_amount(ybr) == 2 && item_amount(c) == 0 && item_amount(s) == 0){
	            	take_storage(1, ybr);
              		take_storage(1, c);
             		take_storage(1, s);
				}
				else if(item_amount(ybr) >= 3 && item_amount(c) == 0 && item_amount(s) == 0){
              		take_storage(1, c);
             		take_storage(1, s);
				}
				else if(item_amount(ybr) == 0 && item_amount(c) >= 1 && item_amount(s) == 0){
	            	take_storage(3, ybr);
             		take_storage(1, s);
				}
				else if(item_amount(ybr) == 0 && item_amount(c) == 0 && item_amount(s) >= 1){
	            	take_storage(3, ybr);
              		take_storage(1, c);
				}
				else if(item_amount(ybr) == 1 && item_amount(c) >= 1 && item_amount(s) == 0){
	            	take_storage(2, ybr);
					take_storage(1, s);
				}
				else if(item_amount(ybr) == 2 && item_amount(c) >= 1 && item_amount(s) == 0){
	            	take_storage(1, ybr);
             		take_storage(1, s);
				}
				else if(item_amount(ybr) >= 3 && item_amount(c) >= 1 && item_amount(s) == 0){
             		take_storage(1, s);
				}
				else if(item_amount(ybr) == 1 && item_amount(c) == 0 && item_amount(s) >= 1){
	            	take_storage(2, ybr);
              		take_storage(1, c);
				}
				else if(item_amount(ybr) == 2 && item_amount(c) == 0 && item_amount(s) >= 1){
	            	take_storage(1, ybr);
              		take_storage(1, c);
				}
				else if(item_amount(ybr) >= 3 && item_amount(c) == 0 && item_amount(s) >= 1){
              		take_storage(1, c);
				}
				else if(item_amount(ybr) == 0 && item_amount(c) >= 1 && item_amount(s) >= 1){
	            	take_storage(3, ybr);
				}
				else if(item_amount(ybr) == 1 && item_amount(c) >= 1 && item_amount(s) >= 1){
	            	take_storage(2, ybr);
				}
				else if(item_amount(ybr) == 2 && item_amount(c) >= 1 && item_amount(s) >= 1){
	            	take_storage(1, ybr);
				}
				else if(item_amount(ybr) >= 3 && item_amount(c) >= 1 && item_amount(s) >= 1){
	            	print("You have all of your drinks.");
				}
				else{
					print("Something went wrong, line 456.");
				}
            }
            else{
            	print("WHAT?! You don't have a Main Stat? Are you an astral spirit?");
            }
		print("Booze gotten.");
        }
	}
#Getting Food
	if(my_level() < 7){
    	print("You're too low of a level to eat this food, why should I get it?");
    }
    else if(my_fullness() >= 1){
    	print("You're too full for this food, why should I get it?");
	}
    else if(my_fullness() == 0 && my_level() >= 7){
    	print("Getting Food");
        if(can_interact()){
       		if(my_primestat() == $stat[muscle]){
            	if(item_amount(hhm) == 0){
					buy(3, hhm);
				}
				else if(item_amount(hhm) == 1){
					buy(2, hhm);
				}
				else if(item_amount(hhm) == 2){
					buy(1, hhm);
				}
				else if(item_amount(hhm) >= 3){
					print("You have your food");
				}
				else{
					print("Something went wrong, line 489.");
				}
            }
           	else if(my_primestat() == $stat[moxie]){
            	if(item_amount(slhm) == 0){
					buy(3, slhm);
				}
				else if(item_amount(slhm) == 1){
					buy(2, slhm);
				}
				else if(item_amount(slhm) == 2){
					buy(1, slhm);
				}
				else if(item_amount(slhm) >= 3){
					print("You have your food");
				}
				else{
					print("Something went wrong, line 506.");
				}
            }
            else if(my_primestat() == $stat[mysticality]){
            	if(item_amount(sphm) == 0){
					buy(3, sphm);
				}
				else if(item_amount(sphm) == 1){
					buy(2, sphm);
				}
				else if(item_amount(sphm) == 2){
					buy(1, sphm);
				}
				else if(item_amount(sphm) >= 3){
					print("You have your food");
				}
				else{
					print("Something went wrong, line 523.");
				}
            }
            else{
            	print("You don't have a class?!");
            }
        }
        else{
        	if(my_primestat() == $stat[muscle]){
            	if(item_amount(hhm) == 0){
					take_storage(3, hhm);
				}
				else if(item_amount(hhm) == 1){
					take_storage(2, hhm);
				}
				else if(item_amount(hhm) == 2){
					take_storage(1, hhm);
				}
				else if(item_amount(hhm) >= 3){
					print("You have your food");
				}
				else{
					print("Something went wrong, line 545.");
				}
            }
            else if(my_primestat() == $stat[moxie]){
            	if(item_amount(slhm) == 0){
					take_storage(3, slhm);
				}
				else if(item_amount(slhm) == 1){
					take_storage(2, slhm);
				}
				else if(item_amount(slhm) == 2){
					take_storage(1, slhm);
				}
				else if(item_amount(slhm) >= 3){
					print("You have your food");
				}
				else{
					print("Something went wrong, line 562.");
				}
            }
            else if(my_primestat() == $stat[mysticality]){
            	if(item_amount(sphm) == 0){
					take_storage(3, sphm);
				}
				else if(item_amount(sphm) == 1){
					take_storage(2, sphm);
				}
				else if(item_amount(sphm) == 2){
					take_storage(1, sphm);
				}
				else if(item_amount(sphm) >= 3){
					print("You have your food");
				}
				else{
					print("Something went wrong, line 579.");
				}
            }
            else{
            	print("You don't have a class?!");
            }
        }
        print("Food obtained.");
    }
#Drinking the booze.
    if(my_level() < 6){
    	print("Too low of a level to drink booze.");
    }
    else if(my_inebriety() >= 2){
    	print("You're too drunk to drink your drinks. Get a soberness pill.");
    }
    else if(!have_skill($skill[Liver of steel])){
    	print("You don't have you're liver of steel, why get overdrunk?");
    }
	else if(my_level() >= 6 && my_inebriety() <= 1 && have_skill($skill[Liver of steel])){
    	print("Drinking Booze");
        if(my_primestat() == $stat[muscle]){
          	drink(3, mt);
            if(item_amount(gt) == 0){
				create(1, gt);
				drink(1, gt);
			}
			else if(item_amount(gt) >= 1){
				drink(1, gt);
			}
			else{
				print("Something went wrong, line 610.")
			}
            
        }
        else if(my_primestat() == $stat[moxie]){
        	drink(3, mw);
            if(item_amount(v) == 0){
				create(1, v);
				drink(1, v);
			}
			else if(item_amount(v) >= 1){
				drink(1, v);
			}
			else{
					print("Something went wrong, line 624.");
				}
        }
        else if(my_primestat() == $stat[mysticality]){
         	drink(3, ybr);
            if(item_amount(ssd) == 0){
				create(1, ssd);
				drink(1, ssd);
			}
			else if(item_amount(ssd) >= 1){
				drink(1, ssd);
			}
			else{
					print("Something went wrong, line 637.");
				}
        }
        else{
          	print("WHAT?! You don't have a Main Stat? Are you an astral spirit?");
        }
        print("Booze Drank");
    }
#Eating...
    if(my_level() < 7){
    	print("Too low of a level to eat.");
    }
    else if(my_fullness() >= 1){
    	print("You're too full to eat this food.");
    }
	else if(my_level() >= 7 && my_fullness() == 0){
    	print("Eating Food.");
        if(my_primestat() == $stat[muscle]){
          	eat(3, hhm);
        }
        else if(my_primestat() == $stat[moxie]){
        	eat(3, slhm);
        }
        else if(my_primestat() == $stat[mysticality]){
         	eat(3, sphm);
        }
        else{
          	print("WHAT?! You don't have a Main Stat? Are you an astral spirit?");
        }
        print("Food Eaten.");
    }
}


Thanks,
-Duff
 
Working..... I can see a few issues in the script, like for instance if you don't have a bartender, you buy 1, then never use it. Logic says you intended to use it. Where I see such things I will auto-correct.
here ya go:

Code:
#
#So my other characters don't use this script.
#
//rather than putting the whole script inside a if statement, abort the script.
//also, display a message saying why the script never ran.
if!(my_name() == "Duffkiligan"){cli_execute("abort " + my_name() + " is not the proper user for this script.");}

boolean verify(int quant, item it)
{
//this function will make sure we have the required amount of the item. if not, then buy the item
//we could use acquire, but that leaves the possibility of getting from the clan stash which may be undesirable.
//remember whenever the word "return" with a value behind it is executed, the function immediately returns
//to the calling point.
#To buy them instead of pulling them out of ronin, obviously you won't pull if you're not in ronin.
if(item_amount(it) < quant)
  {
  if(can_interact())
    return buy(quant - item_amount(it), it);
    else
    return take_storage(quant - item_amount(it), it);
  }
  else
  {
  return true;
  }
}

if(!have_bartender())
{
if(verify(1, $item[bartender-in-the-box]))
  use(1, $item[bartender-in-the-box]
  else
  cli_execute("abort Failed to obtain a bartender.");
}

if( (my_level() >= 6) || have_skill($skill[Liver of steel]) || (my_inebriety() != 0) )
  {
  print("Getting Booze");
  if(my_primestat() == $stat[muscle])
    {
    verify(3, $item[Mon Tiki]);
    drink(3, $item[Mon Tiki]);

    if(item_amount($item[Grogtini]) == 0)
      {
      verify(1, $item[lime]);
      verify(1, $item[grog]);
      create(1, $item[Grogtini]);
      }
    drink(1, $item[Grogtini]);
    }
  if(my_primestat() == $stat[moxie])
    {
    verify(3, $item[Mae West]);
    drink(3, $item[Mae West]);

    if(item_amount($item[vesper]) == 0)
      {
      verify(1, $item[jumbo olive]);
      verify(1, $item[dry vodka martini]);
      create(1, $item[vesper]);
      }
    drink(1, $item[vesper]);
    }
  if(my_primestat() == $stat[mysticality])
    {
    verify(3, $item[yellow brick road]);
    drink(3, $item[yellow brick road]);

    if(item_amount($item[sangria del diablo]) == 0)
      {
      verify(1, $item[cherry]);
      verify(1, $item[sangria]);
      create(1, $item[sangria del diablo]);
      }
    drink(1, $item[sangria del diablo]);
    }
  print("Booze Drank");
  }
  else //print errors.
  {
      if(my_level() < 6)
    	print("Too low of a level to get booze.");
      if(!have_skill($skill[Liver of steel]))
    	print("You don't have you're liver of steel, why get overdrunk?");
      if(my_inebriety() >= 2)
    	print("You're too drunk to drink your drinks. Get a soberness pill.");
  }

#Getting Food
if(my_fullness() == 0 && my_level() >= 7)
  {
  print("Getting Food");
  if(my_primestat() == $stat[muscle])
    {
    verify(3, $item[hot hi mein]);
    eat(3, $item[hot hi mein]);
    }
  if(my_primestat() == $stat[moxie])
    {
    verify(3, $item[sleazy hi mein]);
    eat(3, $item[sleazy hi mein]);
    }
  if(my_primestat() == $stat[mysticality])
    {
    verify(3, $item[spooky hi mein]);
    eat(3, $item[spooky hi mein]);
    }
  print("Food Ate");
  }
  else  //print errors.
  {
  if(my_level() < 7)
    print("You're too low of a level to eat this food, why should I get it?");
  if(my_fullness() >= 1)
    print("You're too full for this food, why should I get it?");
  }

original line count: 668
New Line count: 117

The biggest change came about with the verify function I created inside the script.

Code:
boolean verify(int quant, item it)
{
if(item_amount(it) < quant)
  {
  if(can_interact())
    return buy(quant - item_amount(it), it);
    else
    return take_storage(quant - item_amount(it), it);
  }
  else
  {
  return true;
  }
}

In your original code, you did a much longer version of this repeatedly.

Forgot, I changed the order that things happen in. Instead of buying everything first, it buys then drinks, buys then drinks, buys then eats. It also pulls from storage if in ronin, and will try to but fail in hardcore because I missed that till now.

Shame on me double posting.
 
Wow, that helps so much!

I just have one question.
Two questions:

Shouldn't
Code:
if( (my_level() >= 6) || have_skill($skill[Liver of steel]) || (my_inebriety() != 0) )
Be
Code:
if( (my_level() >= 6) && have_skill($skill[Liver of steel]) && (my_inebriety() <= 1) )
?


And, how could I make it see if I can create the drinks?
Say I'm out of ronin, and I have the supplies for a mae west, however I only have 2 completed.
Will it buy the third or will it make it?
 
[quote author=Duffkiligan link=topic=1522.msg7110#msg7110 date=1202573485]
Wow, that helps so much!

I just have one question.
Two questions:

Shouldn't
Code:
if( (my_level() >= 6) || have_skill($skill[Liver of steel]) || (my_inebriety() != 0) )
Be
Code:
if( (my_level() >= 6) && have_skill($skill[Liver of steel]) && (my_inebriety() <= 1) )
?
[/quote]

I do believe it should. My mistake, and you may find a few more. Be sure you check the if statement for eating also.

[quote author=Duffkiligan link=topic=1522.msg7110#msg7110 date=1202573485]
And, how could I make it see if I can create the drinks?
Say I'm out of ronin, and I have the supplies for a mae west, however I only have 2 completed.
Will it buy the third or will it make it?
[/quote]

Presently it will buy the third. You would want to test
int creatable_amount( item it )
Returns the number of copies of the item that you are capable of creating with your current inventory. Servant availability and remaining adventures are not factored into this calculation.

Then create it.

Another option would be to create a map of the ingredients for everything, and test against it.

You would want to do either option inside the "boolean verify(int quant, item it)" function so that it would function for all of the items. You be able to make the grog instead of buying one.
 
OK you will want to create either the number you can create, or the number needed whichever is lower. You could use a if...else statement, and repeat the code, but creating a function which returns the lower of 2 integers seems more logical so:

Code:
int lower(int number1, int number2)
{
if( number1 < number2)
  return number1;//if we use else we get missing return value.
return number2;
}

That must be in the script somewhere above the verify function.

Now to handle the creation we need to modify the verify function:

Code:
boolean verify(int quant, item it)
{
//this function will make sure we have the required amount of the item. if not, then buy the item
//we could use acquire, but that leaves the possibility of getting from the clan stash which may be undesirable.
//remember whenever the word "return" with a value behind it is executed, the function immediately returns
//to the calling point.
#To buy them instead of pulling them out of ronin, obviously you won't pull if you're not in ronin.
if(item_amount(it) < quant)
  {
  if(creatable_amount(it) > 0)
    create(lower(creatable_amount(it), quant), it);

  if(can_interact())
    return buy(quant - item_amount(it), it);
    else
    return take_storage(quant - item_amount(it), it);
  }
  else
  {
  return true;
  }
}
But this can lead to a bad return value so we need to take steps to fix that.

Code:
boolean verify(int quant, item it)
{
//this function will make sure we have the required amount of the item. if not, then buy the item
//we could use acquire, but that leaves the possibility of getting from the clan stash which may be undesirable.
//remember whenever the word "return" with a value behind it is executed, the function immediately returns
//to the calling point.
#To buy them instead of pulling them out of ronin, obviously you won't pull if you're not in ronin.
if(item_amount(it) < quant)
  {
  if(creatable_amount(it) > 0)
    create(lower(creatable_amount(it), quant), it);

  if(can_interact())
    buy(quant - item_amount(it), it);
    else
    take_storage(quant - item_amount(it), it);
  }
return item_amount(it) >= quant;
}

Note we only have 1 return statement now.

Edit:
return item_amount(it) >= quant;
not
return item_amount(it) > quant;
 
I cannot thank you enough efil. /me hopes I can shorten your name to that.

If I win the raffle I'll send you meat.
xD

I'll need help on some other things later.

But for now I think I can handle it. =]


Edit:
Hm, I put all but 1 mon tiki in my store and ran the script.
It worked fine until I realized that something went wrong.
It didn't drink or get the two missing.
 
You may have to follow the code through. I did not test it, and there may be a bug. also, if kolmafia didn't register that you had put them in your store, then kolmafia would think you had them, and just try to drink them (and fail).

Did you have any inebriety at all at that time?
 
I had no drunkenness.

And it said that I was drinking them, but no drunkenness came out of it.
Okay,

I've added
Code:
if( (my_level()	== 1) && (my_turncount() == 0) )
  {
	storage(1, $item[indie comic hipster glasses]);
	storage(2, $item[bottle-rocket crossbow]);
	storage(1, $item[flaming pink shirt]);
	storage(1, $item[travoltan trousers]);
	storage(2, $item[mr. accessory]);
	storage(1, $item[mr. eh?]);
	storage(1, $item[wax lips]);
  }
And
Code:
boolean storage(int quant, item it)

{

if(item_amount(it) < quant)

  {

  return take_storage(quant - item_amount(it), it);

  }

  else

  {

  return true;

  }

}
The Boolean is the same as verify without the "If can interact".


And when I run it a second time I keep getting:
Code:
You only have 0 indie comic hipster glasses in storage (you wanted 1)
You only have 0 bottle-rocket crossbow in storage (you wanted 2)
You only have 0 flaming pink shirt in storage (you wanted 1)
You only have 0 Travoltan trousers in storage (you wanted 1)
You only have 0 Mr. Accessory in storage (you wanted 2)
You only have 0 Mr. Eh? in storage (you wanted 1)
You only have 0 wax lips in storage (you wanted 1)
 
Top