Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: Daily Farming Script (Formerly Known As "Script Noob")

  1. #1
    Junior Member
    Join Date
    Oct 2006
    Location
    Leeds, UK
    Posts
    13

    Default Daily Farming Script (Formerly Known As "Script Noob")

    Hi i have just got KoLMafia and am a total Scripting Noob.
    I was hoping to and have attempted (after reading replies below) to make a script that:

    Gets dressed into meatfarming outfit
    buys 3 bat wing chow meins, 5 fuzzbump and 1 whiskey sour
    eats three chow meins
    Drinks 4 fuzzbump and a whiskey sour
    Adventure in the castle in the sky for all the turns checking if hp is below 50 after each adventure
    if hp is below 50 it uses one turn resting at the campground and then carries on adventuring
    if hp is 50 or above it carries on adventuring
    Once finished adventuring it:
    Changes outfit to sleep
    Drink another fuzzbump
    Autosell items all items got from castle apart from warm subject gift certificate
    Uses the warm subject gift certificates
    Gets "free" buffs from buffbots (up to date when created)

    I thank you in advance and look forward to learning how to script properly

  2. #2
    Developer
    Join Date
    Mar 2006
    Posts
    1,367

    Default Re: Script Noob

    Sounds like you haven't read the scripting manual yet.

  3. #3
    Junior Member
    Join Date
    Oct 2006
    Location
    Leeds, UK
    Posts
    13

    Default Re: Script Noob

    Thanks for your advice so far

    I have read the scripting manual, understood most of it but was looking for tips on starting and putting it together.

    I will post what i produce when i get going.

    Thanks again

    Edit: Some boards dont allow double posting so i am editting this one

    I have done my research and put together a script that im pretty sure will work. Here is what i have made:
    Code:
    boolean outfit( string meatfarming )
    boolean buy( 3, $item [bat wing chow mein] )
    boolean buy( 5, $item [fuzzbump] )
    boolean buy( 1, $item [whiskey sour] )
    boolean eat( 3, $item [bat wing chow mein] )
    boolean drink( 4, $item [fuzzbump] )
    boolean drink( 1, $item [whiskey sour] )
    #Most unsure about:
    repeat
    boolean adventure( *, $location [The Castle in the Clouds in the Sky] )
    If my_hp()< 80 
    then boolean adventure( 1, $location [Rest at Campsite] )
    until ( my_adventures()=0 );
    # More sure about:
    boolean outfit( string sleep )
    boolean drink( 4, $item [fuzzbump] )
    boolean sell_item( *, $item[angry farmer candy] )
    boolean sell_item( *, $item[awful poetry journal] )
    boolean sell_item( *, $item[chaos butterfly] )
    boolean sell_item( *, $item[disturbing fanfic] )
    boolean sell_item( *, $item[furry fur] )
    boolean sell_item( *, $item[giant needle] )
    boolean sell_item( *, $item[heavy d] )
    boolean sell_item( *, $item[mick's icyvapohotness rub] )
    boolean sell_item( *, $item[original g] )
    boolean sell_item( *, $item[plot hole] )
    boolean sell_item( *, $item[probability potion] )
    boolean sell_item( *, $item[procrastination potion] )
    boolean sell_item( *, $item[thin black candle] )
    boolean sell_item( *, $item[wolf mask] )
    boolean use( *, $item [warm subject gift certificate] )
    cli_execute( send 1 meat to testudinata )
    boolean put_closet( * )
    I will edit the post above so you know what it does

  4. #4
    Senior Member
    Join Date
    Mar 2006
    Location
    New Zealand
    Posts
    386

    Default Re: Script Noob

    The return types (All of those "boolean") you have at the start of each line doesnt need to be there.

    Use a ";" after each command in ASH.

    When defining a string you don't go "string THESTRING" you simply stick the string in speechmarks. So for "string meatfarming", you just need "meatfarming" (WITH the speechmarks).

    If your going to use a "equals" operator you need to have 2 "=" symbols, so a "==".

    cli_execute uses a string value, so stick that in speechmarks.

    The "*" wild for "all of" only works in CLI scripting (As far as I know). If your going to do that in ASH your looking for something like "item_amount( $item[ITEMNAME])".

    When your using "if" your gonna want to stick the conditions in something like: "if( CONDITIONS)".
    Oh and that method of HP checking isn't going to work, it will run all its adventures, and then check. You will probably be wanting a "while" loop, make the condition be remaining adventures and then have the IF check nested in it with it running 1 adventure per loop.

    Uh whats the put_closet for?


    I don't personally use (or have ever used) the "repeat" so im not familiar with that, someone else will have to give pointers for that (Although if you use the while loop method then the repeat becomes redundant)

    Yeah, I'm not going to write it for you =P, but the manual should be perfectly fine and if you get stuck just post and we are here to help.
    It's not like we hurt people or anything... Just steal from 'em... I'm not into hurting people, you know...

  5. #5
    Junior Member
    Join Date
    Oct 2006
    Location
    Leeds, UK
    Posts
    13

    Default Re: Script Noob

    Thanks for that
    I had forgotten to replace the value for the amount of adventures thanks for pointing that out
    I will do some more editting and then repost my script below
    Oh and the put_closet puts the meat in the closet which ive just realised i need to get rid of because then the next day i wont be able to purchase any items

    Here is an editted version:
    Code:
    outfit( "meatfarming" );
    buy( 3, $item [bat wing chow mein] );
    buy( 5, $item [fuzzbump] );
    buy( 1, $item [whiskey sour] );
    eat( 3, $item [bat wing chow mein] );
    drink( 4, $item [fuzzbump] );
    drink( 1, $item [whiskey sour] );
    repeat;
    adventure( 1, $location [The Castle in the Clouds in the Sky] );
    If ( my_hp()< 80 ) ;
    then adventure( 1, $location [Rest at Campsite] );
    until ( my_adventures()==0 );
    outfit( "sleep" );
    drink( 4, $item [fuzzbump] );
    sell_item( item_amount( $item[angry farmer candy] ), $item[angry farmer candy] );
    sell_item( item_amount( $item[awful poetry journal] ), $item[awful poetry journal] );
    sell_item( item_amount( $item[chaos butterfly] ), $item[chaos butterfly] );
    sell_item( item_amount( $item[disturbing fanfic] ), $item[disturbing fanfic] );
    sell_item( item_amount( $item[furry fur] ), $item[furry fur] );
    sell_item( item_amount( $item[giant needle] )], $item[giant needle] );
    sell_item( item_amount( $item[heavy d] ), $item[heavy d] );
    sell_item( item_amount( $item[mick's icyvapohotness rub] ), $item[mick's icyvapohotness rub] );
    sell_item( item_amount( $item[original g] ), $item[original g] );
    sell_item( item_amount( $item[plot hole] ), $item[plot hole] );
    sell_item( item_amount( $item[probability potion] ), $item[probability potion] );
    sell_item( item_amount( $item[procrastination potion] ), $item[procrastination potion] );
    sell_item( item_amount( $item[thin black candle] ), $item[thin black candle] );
    sell_item( item_amount( $item[wolf mask], $item[wolf mask] );
    use( item_amount ( $item [warm subject gift certificate] ), $item [warm subject gift certificate] );
    cli_execute( "send 1 meat to testudinata" );
    I didn't change the repeat to while because i wasn't 100% sure what i would have to do. Would it be something like:

    Code:
    While (my_adventures() >0);
    adventure( 1, $location [The Castle in the Clouds in the Sky] );
    While (my_hp <50);
    adventure( 1, $location [Rest at Campsite] );
    Or would i need to do something with "and"? As always any pointers are well received.

    Afterthought: Is there anyway of checking if the amount of adventures left on a buff is under 210 for example?

  6. #6
    Developer
    Join Date
    Mar 2006
    Posts
    1,367

    Default Re: Script Noob

    For what you're planning on doing, and given that you're not a programmer type, I recommend using basic scripting rather than advanced scripting (the manual in question is linked in the forum announcements that appear at the top of every page, and basic scripting is one of the pages there):

    http://kolmafia.sourceforge.net/scripting.html

  7. #7
    Senior Member
    Join Date
    Mar 2006
    Posts
    729

    Default Re: Script Noob

    I'll tackle this one further.

    OK first let's discuss your method of health restoration. Instead of resting at your campsight which consumes a turn, I would use scrolls of drastic healing which cost 214 meat in the mall. An adventure in the castle is worth more than 214 meat. If this option sounds good to you, then let kolmafia handle it for you.

    while logged in to kolmafia:
    top of kolmafia select the adventure tab
    bottom of kolmafia select auto recovery tab
    set the percentage of your health at which you would like to restore.
    select scroll of drastic healing as the restorer.
    now select preferences on the general menu
    on the items tab make sure "buy items from mall whenever needed" is selected.
    change the adventure area of your script to say
    Code:
    adventure(my_adventures(), $location[Castle in the clouds in the sky]);
    if you really want to rest at your campsight then:
    Code:
    while(my_adventures() != 0)
     {
     adventure(1, $location[Castle in the clouds in the sky]);
     while ( my_hp() < 80 && my_adventures() != 0)
      {
      cli_execute("rest 1");
      }
     }
    using "if ( my_hp() < 80 )" would cause you to rest 1 time only no matter what. It may take 2 times to bring your hp above 80. using "while ( my_hp() < 80 )" will cause the script to repeat the rest command till your hp meets the requirement. adding "&& my_adventures() != 0" in prevents any possibility of an infinite loop if you go below 80 hp on the last adventure. There are other ways to handle this, I am just following the way that your script is going.

    This script from the bgining would really have been easier to write using basic scripting rather than ash as Holatuwol said, but I see a some effort has went into it, and for your first script it sure would be a bummer to have to start over again using what effectively works out to be a different language.

    Edit: oh yeah! in the first version you wanted to put all your meat in your closet. That command was right except that instead of the the wildcard for all, you actually need to use
    Code:
    put_closet(my_meat());
    That definitely proves to me that you have done your homework in attempting to write this script because I had to look that up a second ago to reply in another thread.

  8. #8
    Junior Member
    Join Date
    Oct 2006
    Location
    Leeds, UK
    Posts
    13

    Default Re: Script Noob

    With the hints, suggestions and comments given in the posts above i have changed my script.
    Also i have added in the function of visiting the Mr. Klaw "Skill" Crane Game 3 times as well because my clan now has one. I added messages to be sent for all the buffs i need.
    EDIT: Also also i have added buy and use 24 of knob goblin pet-buffing spray and nasal spray
    I decided to integrate the buy and use 1 scroll of drastic healing into the script so that if other people want to use my script they dont have to set that up.

    Code:
    outfit( "meatfarming" );
    buy( 3, $item [bat wing chow mein] );
    buy( 5, $item [fuzzbump] );
    buy( 1, $item [whiskey sour] );
    buy( 24, $item [Knob Goblin nasal spray] );
    buy( 24, $item [Knob Goblin pet-buffing spray] ) ;
    eat( 3, $item [bat wing chow mein] );
    drink( 4, $item [fuzzbump] );
    drink( 1, $item [whiskey sour] );
    use( 24, $item [Knob Goblin nasal spray] );
    use( 24, $item [Knob Goblin pet-buffing spray] ) ;
    while( my_adventures() !=0 )
     {
     adventure( 1, $location[Castle in the clouds in the sky] );
     while ( my_hp()<80 && my_adventures() !=0 )
      {
      buy( 1, $item [scroll of drastic healing] );		
      use( 1, $item [scroll of drastic healing );
    outfit( "sleep" );
    drink( 4, $item [fuzzbump] );
    sell_item( item_amount( $item[angry farmer candy] ), $item[angry farmer candy] );
    sell_item( item_amount( $item[awful poetry journal] ), $item[awful poetry journal] );
    sell_item( item_amount( $item[chaos butterfly] ), $item[chaos butterfly] );
    sell_item( item_amount( $item[disturbing fanfic] ), $item[disturbing fanfic] );
    sell_item( item_amount( $item[furry fur] ), $item[furry fur] );
    sell_item( item_amount( $item[giant needle] )], $item[giant needle] );
    sell_item( item_amount( $item[heavy d] ), $item[heavy d] );
    sell_item( item_amount( $item[mick's icyvapohotness rub] ), $item[mick's icyvapohotness rub] );
    sell_item( item_amount( $item[original g] ), $item[original g] );
    sell_item( item_amount( $item[plot hole] ), $item[plot hole] );
    sell_item( item_amount( $item[probability potion] ), $item[probability potion] );
    sell_item( item_amount( $item[procrastination potion] ), $item[procrastination potion] );
    sell_item( item_amount( $item[thin black candle] ), $item[thin black candle] );
    sell_item( item_amount( $item[wolf mask], $item[wolf mask] );
    use( item_amount ( $item [warm subject gift certificate] ), $item [warm subject gift certificate] );
    cli_execute( "send 3 meat to testudinata" );
    cli_execute( "send 8 meat to testudinata" );
    cli_execute( "send 6 meat to testudinata" );
    cli_execute( "send 5 meat to testudinata" );
    cli_execute( "send 3 meat to Binary" );
    cli_execute( "send 2 meat to Binary" );
    ***** LINES REMOVED BY DAYCHILDE - SEE BELOW *****
    Over the next few days i may make some more changes and will probably post the final version later in the week

    thanks for all your help so far and any i am going to receive

    Please don't be offended by my edit. Holatuwol has said he isn't automating clan furniture - at least not yet. Previously, posting a "workaround" to such a thing was frowned upon, so I'm "censoring" this for now... I'll also post in the Admin Lounge asking if they feel this way about the furniture or not... :-) Sorry! -Daychilde

  9. #9
    Senior Member
    Join Date
    Mar 2006
    Posts
    729

    Default Re: Script Noob

    for each { you must have a } hence the following is what you want:
    while( my_adventures() !=0 )
    {
    adventure( 1, $location[Castle in the clouds in the sky] );
    while ( my_hp()<80 && my_adventures() !=0 )
    {
    buy( 1, $item [scroll of drastic healing] );
    use( 1, $item [scroll of drastic healing );
    }
    }

    in between each { and } is the block of statements which will repeat during the while loop.

  10. #10
    Junior Member
    Join Date
    Oct 2006
    Location
    Leeds, UK
    Posts
    13

    Default Re: Script Noob

    Hi

    Sorry i have been so long before posting this final draft. I have been trying to add extras into the script but to no avail.

    I attach my script below and hope you enjoy using it if you want.

    If anyone adapts it in any way could you please let me know as i am interested in any developments of my script for future reference.

    Once again a big thank you to everyone here who has helped me along my way from script noob to creating my first script.

    Merry Crimbo to one and all
    Attached Files

Similar Threads

  1. JTN's All-In-One Farming Script
    By jtn2002 in forum Scripting Discussion
    Replies: 16
    Last Post: 05-09-2012, 07:00 PM
  2. The Neo-Cow Farming Script
    By Banana Lord in forum Turn-Burning Scripts
    Replies: 191
    Last Post: 07-07-2011, 11:08 AM
  3. First try at a farming script
    By AgnesM in forum Turn-Burning Scripts
    Replies: 7
    Last Post: 07-14-2008, 05:54 AM
  4. Daily farming script
    By BigH in forum Turn-Burning Scripts
    Replies: 22
    Last Post: 01-12-2007, 08:39 PM
  5. Farming Script
    By mmo.stuff in forum Scripting Discussion
    Replies: 1
    Last Post: 11-29-2006, 09:09 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
  •