Simple (but trying to make it complex) breakfast script

Here's what I have so far.
Code:
void main()
{
	if(my_level() >= 7){
		if(my_primestat() == $stat[muscle]{
			take_storage(3, $item[Mon Tiki])
			take_storage(1, $item[lime])
			take_storage(1, $item[grog])
			drink(3, $item[Mon tiki])
			create(1, grogtini)
			drink(1, grogtini)
	}
	else{

I haven't made my else yet, I figure one step at a time.
an If, else statement seems like it could only be 2 choices, there are three main stats.
How can I make it so it finds which primestat I am without an if, else statement?

Thank you in advance,
-Duff.
 

macman104

Member
Well, you can chain if-else statments together. So you can say
Code:
if(muscle class)
{	
	code here
}
else if(myst class)
{
	code here
}
else if(mox class)
{
	code here
}
Or, you can use maps. But if you are new to scripting you may not know what those are yet. Anyway, just for humor, here's something I whipped up. The template shouldn't be too hard to follow to adapt for more use
Code:
record statFoods
{
	int [item] pullList;
	int [item] createList;
	int [item] drinkList;
};

statFoods [$stat] statList;

statList[$stat[muscle]].pullList[$item[Mon Tiki]] = 3;
statList[$stat[muscle]].pullList[$item[lime]] = 1;
statList[$stat[muscle]].pullList[$item[grog]] = 1;
statList[$stat[muscle]].createList[$item[grogtini]] = 1;
statList[$stat[muscle]].drinkList[$item[Mon Tiki]] = 3;
statList[$stat[muscle]].drinkList[$item[grogtini]] = 1;

statFoods shortcut = statList[my_primestat()];

foreach item in shortcut.pullList
{
	take_storage(shortcut.pullList[item], item);
}

foreach item in shortcut.createList
{
	create(shortcut.createList[item], item);
}

foreach item in shortcut.drinkList
{
	drink(shortcut.drinkList[item], item);
}
 
I think I get the map.

if I wanted to add more to say a moxie class, just add

Code:
statList[$stat[moxie]].pullList[$item[Mae West]] = 3;
statList[$stat[moxie]].drinkList[$item[Mae West]] = 3;
?
 
Sweet.
I will defiantly try that today!

I'm in ronin and a muscle class!

thank you so much macman.

I'm sure I'll come back for more help.
I'm trying to make this breakfast script complete for me.
Can I make it check if I'm in ronin or not?
'Cause if I'm not, I won't want to pull anything.
 
That's all well and good, now how about if I'm already drunk?

It'll over drink, no?
Here's my simple script so far.
It checks for the liver of steel, and that I can drink and eat these things.
Also that my level is high enough.

Code:
void main(){
	if((my_level() >= 6) && (have_skill($skill[Liver of Steel]))){
		if(my_primestat() == $stat[muscle] && my_inebriety() <= 1){
			item mt = $item[Mon Tiki];
			item l = $item[lime];
			item g = $item[grog];
			item gt = $item[grogtini];
			if (can_interact()){
				buy(3, mt);
				buy(1, l);
				buy(1, g);
			}
			else{

				take_storage(3, mt);
				take_storage(1, l);
				take_storage(1, g);
			}
			create(1, gt);
			drink(3, mt);
			drink(1, gt);
		}
		else{
			print("Too Drunk.... Find alternate drinks.");
		}
		if(my_primestat() == $stat[muscle] && my_fullness() = 0 && my_level() >= 7){
			item hhm = $item[hot hi mein];
			if(can_interact()){
				buy(3, hhm);
			}
			else{
				take_storage(3, hhm);
			}
			eat(3, hhm);
		}
		else{
			print("Too Full.... Find alternate food.");
		}
	}
}

Also, here's my attempt at adding to the map:
Code:
record statFoods
{
	int [item] pullList;
	int [item] createList;
	int [item] drinkList;
	int [item] eatList;
};

statFoods [$stat] statList;

statList[$stat[muscle]].pullList[$item[Mon Tiki]] = 3;
statList[$stat[muscle]].pullList[$item[lime]] = 1;
statList[$stat[muscle]].pullList[$item[grog]] = 1;
statList[$stat[muscle]].pullList[$item[hot hi mein]] = 3;
statList[$stat[muscle]].createList[$item[grogtini]] = 1;
statList[$stat[muscle]].drinkList[$item[Mon Tiki]] = 3;
statList[$stat[muscle]].drinkList[$item[grogtini]] = 1;
statList[$stat[muscle]].eatList[$item[hot hi mein]] = 1;

statFoods shortcut = statList[my_primestat()];

foreach item in shortcut.pullList
{
	if(can_interact())
	{
		buy(shortcut.pullList[item], item);
	}
	else
	{
		take_storage(shortcut.pullList[item], item);
	}
}

foreach item in shortcut.createList
{
	create(shortcut.createList[item], item);
}

foreach item in shortcut.drinkList
{
	drink(shortcut.drinkList[item], item);
}
foreach item in shortcut.eatlist
{
	eat(Shortcut.eatList[Item], item);
}
 
Okay... I've gotten to the point of rewriting my script.
It's perfect except for one thing.

How can I make it check to see if it has the items already?
I don't want to be wasting meat or pulls on items I already have.

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];
if(my_name() == "Duffkiligan"){
    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");
    	if(can_interact()){
        	if(my_primestat() == $stat[muscle]){
            	buy(3, mt);
                buy(1, l);
                buy(1, g);
            }
            else if(my_primestat() == $stat[moxie]){
            	buy(3, mw);
                buy(1, jo);
                buy(1, dvm);
            }
            else if(my_primestat() == $stat[mysticality]){
            	buy(3, ybr);
                buy(1, c);
                buy(1, s);
            }
            else{
            	print("WHAT?! You don't have a Main Stat? Are you an astral spirit?");
            }
		}
        else{
        	 if(my_primestat() == $stat[muscle]){
            	take_storage(3, mt);
                take_storage(1, l);
                take_storage(1, g);
            }
            else if(my_primestat() == $stat[moxie]){
            	take_storage(3, mw);
                take_storage(1, jo);
                take_storage(1, dvm);
            }
            else if(my_primestat() == $stat[mysticality]){
            	take_storage(3, ybr);
                take_storage(1, c);
                take_storage(1, s);
            }
            else{
            	print("WHAT?! You don't have a Main Stat? Are you an astral spirit?");
            }
		print("Booze gotten.");
        }
	}
	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]){
            	buy(3, hhm);
            }
           	else if(my_primestat() == $stat[moxie]){
            	buy(3, slhm);
            }
            else if(my_primestat() == $stat[mysticality]){
            	buy(3, sphm);
            }
            else{
            	print("You don't have a class?!");
            }
        }
        else{
        	if(my_primestat() == $stat[muscle]){
            	take_storage(3, hhm);
            }
            else if(my_primestat() == $stat[moxie]){
            	take_storage(3, slhm);
            }
            else if(my_primestat() == $stat[mysticality]){
            	take_storage(3, sphm);
            }
            else{
            	print("You don't have a class?!");
            }
        }
        print("Food obtained.");
    }
    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);
            create(1, gt);
            drink(1, gt);
        }
        else if(my_primestat() == $stat[moxie]){
        	drink(3, mw);
            create(1, v);
            drink(1, v);
        }
        else if(my_primestat() == $stat[mysticality]){
         	drink(3, ybr);
            create(1, sdd);
            drink(1, sdd);
        }
        else{
          	print("WHAT?! You don't have a Main Stat? Are you an astral spirit?");
        }
        print("Booze Drank");
    }
    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 shitty 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.");
    }
}
 
Top