Please excuse the intense length and noobyness xD.
Hi everyone, I'm new to scripting and I'm attempting to make something that seems a little complex to me... I've been looking around the manual, and I'm currently writing a script to farm using my (brand spankin' new) Ninja Pirate Zombie Robot.
Now, before I post the script as I have written thus far, here are the actions I intend for it to perform:
Put on the NPZR outfit
Buy 5 Salty Dogs
Drink 5 Salty Dogs
Adventure at the Castle in the Clouds in the Sky
After each adventure, cast Leash of Linguini based on remaining MP
Keep adventuring until only 3 adventures remain
Put on the Rollover outfit
Send 6 meat to Testudinata
Send 8 meat to Testudinata
Send 1 meat to Testudinata
Sell all my Toast for 110 meat each with a limit of 5.
Output summary to E:\farm.txt
Print "Done." to the screen
[glow=red,2,300]npzr hunt.txt:[/glow]
----------------------------------------
outfit npzr
buy 5 salty dog
drink 5 salty dog
---EXECUTE--- hunt.ash
outfit rollover
send 6 meat to testudinata
send 8 meat to testudinata
send 1 meat to testudinata
mallsell Toast 110 5
summary E:\farm.txt
echo Done.
----------------------------------------
[glow=red,2,300]hunt.ash:[/glow]
----------------------------------------
void huntit()
{
while ( my_adventures() > 2)
{
adventure( 1, The Castle in the Clouds in the Sky );
---EXECUTE---( leash.ash );
}
return;
}
----------------------------------------
[glow=red,2,300]leash.ash:[/glow]
----------------------------------------
void leash()
{
while( my_mp() > 11)
{
int tocast;
int currentmp;
currentmp = my_mp();
tocast = currentmp / 12;
if( tocast == 0)
{
cast_leash( tocast);
}
}
return;
}
void cast_leash()
{
if( have_skill( Leash of Linguini )
{
use_skill( tocast, $skill[Leash of Linguini] );
}
}
----------------------------------------
Now for the not-so-great bits...
First of all, I'm not entirely sure what I'd put when I want the script (or sub-script?) to terminate itself and either end the whole thing or continue on with its parent script. In a post somewhere on this forum I saw someone use "return;" so I hope that's what it is =P.
When selling the Toast (NPZR likes to pick these up), will it only put in one, or will it put in all of them? If only one, then I will have to write a script to make it continue doing so until I have no more toast left. No biggie.
Assuming the adventures performed will deal with combat in the normal weapon-fighting way, how can I ensure that it refers to the Custom Combat Script instead? This is essential as the combat script dictates the number of times to use the Dictionary to pass rounds without dealing damage, and to commence regular attacks at round 29.
Also, if I were to have a summary, an encounter list, and an inventory list (for example), all outputted to files, would it work if I directed them to the same file? The idea is for the results to appear in a sequential fashion (appended), rather than having the entire file overwritten each time. That's not exactly what I'm looking for, though, as really what I'm interested in is having the summary file include all the times I've ever run the script.
Lastly, and very importantly, what command must I use to have a script execute another script? At the moment I have those bits substituted with "---EXECUTE---," but that obviously isn't going to cut it... I do this simply so that I have the different parts clearly divided. If it is not possible, I suppose I could have it all in ASH and put it in a single file.
Oh and before I end this, I was wondering whether it is possible to use both the more-basic scripting (covered in "Scripting with KoLmafia") and advanced scripting (ASH, covered in "Advanced Scripting With KoLmafia") in the same script. I imagine this would make a few people's lives a little easier, though I don't expect it to parse two different syntax-y-thingies at once.
And, uhh, that's it. Any help would be greatly appreciated =).
( split previous post and put your writings as guest in here so you could modify them if you wanted to at some point... -Daychilde )
Oopsies. I just registered and discovered that there is an whole forum for this kinda thing...
Could a mod please move this thread? =)
Thanks.
Hi everyone, I'm new to scripting and I'm attempting to make something that seems a little complex to me... I've been looking around the manual, and I'm currently writing a script to farm using my (brand spankin' new) Ninja Pirate Zombie Robot.
Now, before I post the script as I have written thus far, here are the actions I intend for it to perform:
Put on the NPZR outfit
Buy 5 Salty Dogs
Drink 5 Salty Dogs
Adventure at the Castle in the Clouds in the Sky
After each adventure, cast Leash of Linguini based on remaining MP
Keep adventuring until only 3 adventures remain
Put on the Rollover outfit
Send 6 meat to Testudinata
Send 8 meat to Testudinata
Send 1 meat to Testudinata
Sell all my Toast for 110 meat each with a limit of 5.
Output summary to E:\farm.txt
Print "Done." to the screen
[glow=red,2,300]npzr hunt.txt:[/glow]
----------------------------------------
outfit npzr
buy 5 salty dog
drink 5 salty dog
---EXECUTE--- hunt.ash
outfit rollover
send 6 meat to testudinata
send 8 meat to testudinata
send 1 meat to testudinata
mallsell Toast 110 5
summary E:\farm.txt
echo Done.
----------------------------------------
[glow=red,2,300]hunt.ash:[/glow]
----------------------------------------
void huntit()
{
while ( my_adventures() > 2)
{
adventure( 1, The Castle in the Clouds in the Sky );
---EXECUTE---( leash.ash );
}
return;
}
----------------------------------------
[glow=red,2,300]leash.ash:[/glow]
----------------------------------------
void leash()
{
while( my_mp() > 11)
{
int tocast;
int currentmp;
currentmp = my_mp();
tocast = currentmp / 12;
if( tocast == 0)
{
cast_leash( tocast);
}
}
return;
}
void cast_leash()
{
if( have_skill( Leash of Linguini )
{
use_skill( tocast, $skill[Leash of Linguini] );
}
}
----------------------------------------
Now for the not-so-great bits...
First of all, I'm not entirely sure what I'd put when I want the script (or sub-script?) to terminate itself and either end the whole thing or continue on with its parent script. In a post somewhere on this forum I saw someone use "return;" so I hope that's what it is =P.
When selling the Toast (NPZR likes to pick these up), will it only put in one, or will it put in all of them? If only one, then I will have to write a script to make it continue doing so until I have no more toast left. No biggie.
Assuming the adventures performed will deal with combat in the normal weapon-fighting way, how can I ensure that it refers to the Custom Combat Script instead? This is essential as the combat script dictates the number of times to use the Dictionary to pass rounds without dealing damage, and to commence regular attacks at round 29.
Also, if I were to have a summary, an encounter list, and an inventory list (for example), all outputted to files, would it work if I directed them to the same file? The idea is for the results to appear in a sequential fashion (appended), rather than having the entire file overwritten each time. That's not exactly what I'm looking for, though, as really what I'm interested in is having the summary file include all the times I've ever run the script.
Lastly, and very importantly, what command must I use to have a script execute another script? At the moment I have those bits substituted with "---EXECUTE---," but that obviously isn't going to cut it... I do this simply so that I have the different parts clearly divided. If it is not possible, I suppose I could have it all in ASH and put it in a single file.
Oh and before I end this, I was wondering whether it is possible to use both the more-basic scripting (covered in "Scripting with KoLmafia") and advanced scripting (ASH, covered in "Advanced Scripting With KoLmafia") in the same script. I imagine this would make a few people's lives a little easier, though I don't expect it to parse two different syntax-y-thingies at once.
And, uhh, that's it. Any help would be greatly appreciated =).
( split previous post and put your writings as guest in here so you could modify them if you wanted to at some point... -Daychilde )
Oopsies. I just registered and discovered that there is an whole forum for this kinda thing...
Could a mod please move this thread? =)
Thanks.