Need Help Getting Started

Savior

New member
You all seem like very nice people, and I thank you for such a warm community feeling. I am very interested in creating some of my own ash/txt files that work with KoLMafia. Would y'all please recommend to me how I can get started? I do not know anything about scripting... at all. Any help will be appreciated please.

Thank you.
 

dangerpin

Member
The first thing I would do is start asking yourself to make a list of all the things you do every day, or would do every day if you remembered, and then work towards creating scripts that do these daily tasks automatically.

Next read this:
http://kolmafia.sourceforge.net/scripting.html

That will probably give you some more ideas about what you can include in your scripts. And a little bit of info on how to structure the script. Generally speaking, if you aren't sure how to do something, assume it is the easiest possible way. If you want to start the day by putting on your custom outfit that you named Fighter, how would you express that? If you guessed

Code:
 outfit Fighter
you would be right. It is almost always just this simple.

Make sure the Graphical CLI tab is one of your basic tabs and start using cli commands to do those daily tasks, these are the same commands you would use in a txt script. When you feel confident that the commands you are using on the cli are doing what you need, put each command on a separate line in the text file.

You just created your first script. Put it in the Scripts folder on your computer and you can call it either from the command line or from the scripting drop-down. Remember, if you need help on how a command works you can use the CLI's built-in help files to get more info. Just type help and the name or partial name of the command.

Rinse, lather, repeat.

When bored of that, try reading some of the other articles here:

http://wiki.kolmafia.us/index.php?title=Main_Page

When that gets you confused, or stuck, start downloading some of the other scripts here that do what you are trying to do and see how they overcame problems and what processes they used to reach the goal.

Did I miss anything useful, anyone?
 

Bale

Minion
Sounds like great advice to me.

dangerpin said:
The first thing I would do is start asking yourself to make a list of all the things you do every day, or would do every day if you remembered, and then work towards creating scripts that do these daily tasks automatically.

That's exactly how I got started. It was a very simple and choice-free list of daily tasks. Then I slowly started to make the script more complicated, adding things like create the milk of magnesium if I was a sorcerer, but purchase it from the mall if I'm not a sorcerer. Now it has gotten to the stage where it uses zarqon's value script to find out which supercocktail is currently cheapest and drink that one.

The process of slowly improving and making that very simple script into something more complicated has taught me a lot about scripting. Everything I need to know I have learned from those two links you mentioned and by dissecting other people's scripts posted on this forum.
 
Last edited:

zarqon

Well-known member
Excellent words from my friends above. Follow their words and you can't go wrong. I have just a few more to add, on the conceptual level:

Script: A copy of a text used by a director or performer.

In this case, mentally replace "performer" with "program." A script is just a bunch of lines in a certain order which the program is to read, interpret, and perform. The lines should be in the performer's language, or the performer cannot perform them. For Les Miserables, that's French. For Rigoletto, Italian. For KoLmafia, we can use a couple different languages.

The first, and the one I recommend to get your feet wet, is CLI commands. These are commands which you can normally enter into the gCLI pane in mafia. Put a bunch of them together in a text file, one per line, and you have a script! (KoLmafia, like a good performer, will deliver the lines in the script in order.) There is a fairly comprehensive list of commands that can do most things you would normally do by lots of clicking. Definitely read the above links for more info about that.

The second is ASH, which is a more complicated language. In ASH, the performer (mafia) is easily thrown off if you don't use correct spelling, punctuation, and grammar. But you can do much more complicated routines with ASH, as some of the larger scripts around here demonstrate.

I'd recommend getting familiar with CLI commands first. Then, as the need presents itself (and if you start getting into it, the need will present itself), you can start to venture into the bigger, more powerful world of ASH.

One other resource I would give you for a lot of great CLI command usage: Hippymon's sidequest catalog. These scripts were very educational for me when I was beginning to write scripts for mafia.

Let us know how you fare!
 

Paragon

Member
also on the cli there is a command ashref, just type ashref and it lists all the ash commands... (I think it lists all of them but I am not sure.) Also, ashref <term> and it shows just the commands with that term.

also if you type ash <ashfunction> it will run the command as though it were in a script which is nice for figuring out how particular commands work.
 

Bale

Minion
If you're going to bring up ashref you should also mention help which does the same thing for CLI commands.
 

Savior

New member
Thanks for everyone's reply! Now I have something enjoyable to do during my Christmas break in three weeks. I need to prepare for my finals, but after that, I plan to post my scripts on here to get help with if it doesn't work.

Thanks again!
 
Top