Not really. It's just that ASH works a little differently from the CLI commands you may be used to. In the CLI, "Equip" will show you your equipment and "Equip <item>" will equip whatever the item is you tell it to equip. In ASH, "Equip" is not a defined variable and you have to tell it what to equip in the right way.
What you may find easier as you try to work out ASH, is to use the CLI commands you know within your scripts until you work out their counterparts. However, again this must be done following the rules.
Code:
cli_execute("CLI command");
will do this for you. So, again, your script written in ASH, but using the CLI commands you may be more familiar with, would appear as:
Code:
cli_execute( "Equip Nurse's hat" );
cli_execute( "Equip Sponge Pants" );
cli_execute( "Equip Spongy shield" );
cli_execute( "Equip acc1 ring of half-assed generation" );
cli_execute( "adventure 40 hidden temple" );
if health =< 20
cli_execute( "buy Doc Galaktik's Ailment Ointment");
cli_execute( "use Doc Galaktik's Ailment Ointment" );
Please note though, this script will not do what you want it to at this point. All I have done is turned your CLI commands into a form that ASH understands (in principle). Next you must think about the order you want the script to do things in. For example, you are telling mafia to adventure 40 times in the hidden temple, then check to see if your health is less than 20 and act accordingly. Surely you want to do this after every adventure?
A side note: notice that every statement/line ends with a semi-colon. This is crucial. The semi-colon is a programming way of adding a full stop. In the same way you would close every full sentence with a "." when writing letters, do the same for coding with a ";".
So, thinking in a logical order, I reasoned that you would want to be checking your health after every adventure. A quick check on the wiki tells my that
my_hp() is the correct function to return an integer value for health, so I used that instead of "health". Phrasing that statement correctly gave me:
Code:
if ( my_hp() < 20 )
{
cli_execute( "buy Doc Galaktik's Ailment Ointment");
cli_execute( "use Doc Galaktik's Ailment Ointment" );
}
Putting that into the code, I reasoned that the first thing you would want to do would be to equip the relevant items, then think about starting to adventure. This gave me:
Code:
cli_execute( "Equip Nurse's hat" );
cli_execute( "Equip Sponge Pants" );
cli_execute( "Equip Spongy shield" );
cli_execute( "Equip acc1 ring of half-assed generation" );
int adv_to_use = 40;
while( adv_to_use > 0 )
{
if ( my_hp() < 20 )
{
cli_execute( "buy Doc Galaktik's Ailment Ointment");
cli_execute( "use Doc Galaktik's Ailment Ointment" );
}
cli_execute( "adventure 1 hidden temple" );
adv_to_use = adv_to_use - 1;
}
You can see, I hope, how this is starting to look like the script presented above. Important and hitherto unseen additions in this example are my use of "int adv_to_use" and also "while()". I'll explain these now, at least superficially. You said the intention was to adventure for 40 turns. However, you also wish to check your health between each adventure, which means that if you do not wish to use mafia's inbuilt ability to recover health, you have to treat each adventure as a separate event.
I therefore invoked an integer called (in short) adventures to use. I said that this would be forty. However, notice that after adventuring, the script subtracts 1 from this integer, meaning that after 40 adventures, adv_to_use will equal 0.
This is where "while" comes in. I have told mafia that it is only to adventure and check health while our integer adv_to_use is greater than 0. When it hits 0 (after the fortieth adventure) the script will stop.
Now, on to the more interesting stuff. I have already pointed to the kolmafia wiki; well worth a read! All of the CLI commands listed here can be turned into sensible ASH commands. They need to make sense, however and this means following the rules. All items should be designated as such by calling them "$item[item name]". Slots need to be alluded to with "$slot[equipment slot]" and locations need to be referred to with "$location[location name]". These are fairly simple and there's nothing too ambiguous. If you ever need clarification, check the wiki! See
Datatype Constants for a more comprehensive list, including what can be entered within them.
My final addition to the script was to include your own adventure number in the script. This means that when your adventures (invoked using
my_adventures()) gets to 0 the script will stop instead of failing. In addition, I also decided not to define adv_to_use within the script and allow the user to do so themselves according to their requirements. I therefore encapsulated the script within a function (called main) that took an integer as an argument and worked off that.
I really would recommend you try out more simple scripts. Try editing your own hiddentemple.ash script and see if you can make it work (maybe using a different technique from the one I described here). Also, read up on the wiki as you create - don't read it in a book-like manner and expect to remember it. Finally, please feel free to post more of your scripts as you make them (maybe in this thread instead of spamming too much!). Getting other people to look at your code will give you pointers on different directions and approaches you can take, as well as learning basic can and can'ts of ASH scripting.
Hope this has helped!