Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 25

Thread: How do you write an ASH file?

  1. #1

    Default How do you write an ASH file?

    I'm looking over the basic commands for scripting and I want to give it a shot.

    What program do I use to start writing? Is there a command in KoLMafia that brings up an empty notepad that will save things in .ash format for you?

    Do you just write it in a notepad and change the file extention to .ash?

  2. #2
    Minion asturia's Avatar
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    201

    Default

    I'm looking over the basic commands for scripting and I want to give it a shot.

    What program do I use to start writing? Is there a command in KoLMafia that brings up an empty notepad that will save things in .ash format for you?

    Do you just write it in a notepad and change the file extention to .ash?
    Originally Posted by Mystia View Post
    I use notepad++ to edit my ash scripts.
    I have a syntax file so that it assigns colors to the scripts.
    I'll attach it here.
    But seriously, don't use notepad, use Notepad++

  3. #3

    Default

    I don't have any characters with adventures I can test this on, but are there any major errors with this script? If I saved it as .ash and executed it, would it work?

    {
    cli_execute("acquire milk of magnesium")
    cli_execute("acquire 15 twinkly wad")
    cli_execute("use 15 twinkly wad")
    cli_execute("acquire 19 blackberry schnapps")
    cli_execute("drink 19 blackberry schnapps")
    cli_execute("acquire 3 hi mein")
    cli_execute("use 1 milk of magnesium")
    cli_execute("eat 3 hi mein")
    cli_execute("outfit Castle")
    cli_execute("familiar leprechaun")
    cli_execute("equip meat detector")
    cli_execute("adventure * Giant's Castle")
    cli_execute("autosell * heavy D, * Original G, * disturbing fanfic, * furry fur, * wolf mask, * awful poetry journal, * thin black candle, * chaos butterfly, * plot hole, * probability potion, * procrastination potion, * angry farmer candy, * giant needle, * Mick's IcyVapoHotness Rub, * rave whistle")
    cli_execute("acquire 1 roll in the hay")
    cli_execute("drink 1 roll in the hay")
    cli_execute("use * Warm Subject gift certificate");
    }

  4. #4

    Default

    If everything is going to be a cli_execute command, why not just make it a .txt and drop those? Easier growth later?

  5. #5

    Default

    I just started scripting today. cli_execute is just what I'm starting with.

    I want to make sure I'm on the right track before adding things to it.

  6. #6
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,287

    Default

    Notepad++ is free and easy to download. I'm attching the syntax highlighting for ash to this post. Unzip it and place it in the same directory as notepad++.exe

    No, that script would not work. You forgot to put semi-colons at the end of each line. You also did not specify which hi mein to eat. If you fixed that it would work, but this would be better:

    Code:
    retrieve_item(1, $item[milk of magnesium])
    retrieve_item(15, $item[twinkly wad]);
    use(15, $item[twinkly wad]);
    retrieve_item(19, $item[blackberry schnapps]);
    drink(19, $item[blackberry schnapps]);
    use(1, $item[milk of magnesium]);
    cli_execute("cheapest hi mein; acquire 3 it; eat 3 it;");
    outfit("Castle");
    use_familiar($familiar[leprechaun]);
    equip($slot[familiar], familiar_equipment(my_familiar()));
    adventure(my_adventures(), $location[Giant's Castle]);
    batch_open();  // This tells mafia that there will be a lot of autoselling, malling or other batch activity, so it should save them up.
    int saleprice = 0;
    foreach it in $items[heavy D, Original G, disturbing fanfic, furry fur, wolf mask, awful poetry journal, thin black candle, 
      chaos butterfly, plot hole, probability potion, procrastination potion, angry farmer candy, giant needle, Mick's IcyVapoHotness Rub, 
      rave whistle] {
    	autosell(item_amount(it), it);
    	saleprice = item_amount(it) * autosell_price(it) + saleprice;
    }
    batch_close();  // Now it executes all recorded batch ativitites in groups of 11 at a time.
    print("autosold trash for "+ saleprice +" meat.", "blue");
    retrieve_item(1, $item[roll in the hay]);
    drink(1, $item[roll in the hay]);
    use(item_amount($item[Warm Subject gift certificate]), $item[Warm Subject gift certificate]);
    Hopefully by comparing my ash to your cli script, you can learn a lot about ash.
    Attached Files
    Last edited by Bale; 05-16-2010 at 05:27 AM. Reason: updated syntax highlighting file
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  7. #7
    Junior Member
    Join Date
    May 2008
    Posts
    1

    Default

    Regarding the userDefineLang.xml file I had some trouble locating where to put it, same folder as notepad++.exe didn't work. Some internet searching told me to put it at %APPDATA%/Notepad++ instead, which worked for me.
    I assume the location varies depending on operating system and settings used at install.

  8. #8
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,287

    Default

    Good point!
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  9. #9

    Default

    Thanks, Bale. That definitely helped me pick up on some of the coding.

    Now I'm wondering how to work if/then strings, particularly, with comparing cheapest mall prices and letting the cost of the item determine whether or not it executes the script based on the mall price.

    Are there more basic scripts out there I can glean information from, like the one you posted here?


    edit: grammar fix

  10. #10
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,287

    Default

    There are tons of scripts you can learn from. Just look around. Even if a script seems too large to get a grasp on, perhaps some part of it will help you.

    Also, when I'm in the mood I produce examples to order. I think you could learn from something I posted yesterday here. I'll just copy-paste it for convenience.

    Code:
    void cheapest_first (item [int] commodity) {
    	int [item] price;
    	foreach key in commodity
    		if(historical_age(commodity[key]) >0.5)
    			price[ commodity[key] ] = mall_price(commodity[key]);
    		else
    			price[ commodity[key] ] = historical_price(commodity[key]);
    	sort commodity by price[value];
    }
    
    item cheapest_shc() {
    	item [int] drinkies;
    	foreach key in $items[Neuromancer, stratocaster, Mon Tiki, teqiwila slammer, Divine, Gordon Bennett, gimlet, yellow brick road,
    	  mandarina colada, tangarita, Mae West, prussian cathouse]
    		drinkies[count(drinkies)] = key;
    	cheapest_first(drinkies);
    	return drinkies[0];
    }
    
    void main() {
    	print("Cheapest Superhuman Cocktail is: "+ cheapest_shc());
    }
    That's obviously a bit more complicated than the earlier script. It makes use of maps to create a list of all supercocks so that it can order them from cheapest to most expensive. I'm not really sure what you're trying to do exactly, but if you need explanations of any part of the above script let me know. If you want to do something entirely different, I'll probably give you some tips about that also.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


Similar Threads

  1. Replies: 0
    Last Post: 02-10-2012, 11:50 PM
  2. Replies: 0
    Last Post: 01-20-2012, 05:11 PM
  3. Feature write{}
    By bordemstirs in forum Bug Reports
    Replies: 2
    Last Post: 04-14-2011, 02:42 AM
  4. Replies: 0
    Last Post: 01-21-2010, 04:23 PM
  5. Replies: 0
    Last Post: 08-29-2009, 03:50 PM

Posting Permissions

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