Results 1 to 8 of 8

Thread: Simple (but trying to make it complex) breakfast script

  1. #1

    Default 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.

  2. #2
    Senior Member
    Join Date
    Mar 2006
    Posts
    488

    Default Re: Simple (but trying to make it complex) breakfast script

    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);
    }

  3. #3

    Default Re: Simple (but trying to make it complex) breakfast script

    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;
    ?

  4. #4
    Senior Member
    Join Date
    Mar 2006
    Posts
    488

    Default Re: Simple (but trying to make it complex) breakfast script

    Yup, exactly!

  5. #5

    Default Re: Simple (but trying to make it complex) breakfast script

    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.

  6. #6
    Senior Member
    Join Date
    Mar 2006
    Posts
    488

    Default Re: Simple (but trying to make it complex) breakfast script

    Code:
    foreach item in shortcut.pullList
    {
    	if(can_interact())
    	{
    		buy(shortcut.pullList[item], item);
    	}
    	else
    	{
    		take_storage(shortcut.pullList[item], item);
    	}
    }
    Also, some posts about maps and records.

    Records in ASH
    Random post with some example code
    ASH Typedefs and some maps example code
    Illustration of how mafia handles maps
    Topic of ASH map questions

  7. #7

    Default Re: Simple (but trying to make it complex) breakfast script

    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);
    }

  8. #8

    Default Re: Simple (but trying to make it complex) breakfast script

    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.");
        }
    }

Similar Threads

  1. Replies: 4
    Last Post: Yesterday, 11:16 PM
  2. SmartStasis -- a complex script for a simple CCS
    By zarqon in forum Custom Combat Settings
    Replies: 1877
    Last Post: Yesterday, 02:43 PM
  3. Replies: 0
    Last Post: 02-25-2014, 12:05 AM
  4. Run a Complex Script for 'X' Turns - OCW, etc.
    By Raven434 in forum Community Support
    Replies: 5
    Last Post: 01-07-2010, 10:06 PM
  5. Help with Simple Script
    By skateboard34 in forum Community Support
    Replies: 6
    Last Post: 12-25-2008, 01:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •