I've started working on a few scripts in ASH and have a couple of questions about things that have come up, and whether my proposed methods of handling them are needless work.
The first thing I started working on was a not-a-pipe farming script that I could use in conjunction with regular adventuring. The idea is to constantly farm not-a-pipes while doing other things (such as powerleveling or farming something else). I had no trouble with identifying where in the absinthe cycle I was and adventuring properly at the various Wormwood locations.
However, when I tried to incorporate allowing for arbitrary adventuring, I ran into a problem with conditions. I don't have the exact script I was using at the time but the problem I was running into was that if I set conditions using cli_execute() and then adventured in a place for one adventure, if the conditions were not satisfied, the entire ASH script would halt, saying "Conditions not satisfied after 1 adventure," even if there was more script to run.
Here's some sample code that might illustrate better (reconstructed from memory, so it might have bugs, but the idea isn't that complex):
void main(int adv_ct, location otherloc, string conditions)
{
adv_ct = adv_ct - pipeadv(); //pipeadv does the right thing for the absinthe cycle and returns the number of adventures consumed while so doing
while (adv_ct > 0)
{
abs = have_effect($effect[Absinthe-Minded]);
while (abs != 9 && abs!= 5 && abs!=1)
{
cli_execute("conditions clear; conditions add " + string);
adventure(1,$location[otherloc]); //this halts if conditions aren't filled after 1 adventure.
adv_ct = adv_ct - 1;
abs = abs - 1;
}
adv_ct = adv_ct - pipeadv();
}
}
So the idea is to run this script with arguments of a number of adventures, a location, and some conditions, and stay Absinthe-Minded all the time, hitting the 9/5/1 absinthe adventures, and adventuring at otherloc until either adv_ct adventures are consumed total, or until conditions are met, and then halting. I figure that if this behavior is the way it's supposed to work, I can write a conditions parser and test the conditions myself after each adventure. This is probably more flexible but I dont want to do that if I'm just missing something obvious.
Second, something similar caused a problem for me when I tried, for example, to do the Cyrpt quest; only now it was that once I cleared the area, the script got caught in an infinite loop. This was due to somewhat lame scripting on my part, but in light of the halting when conditions weren't met above, I kind of expected the script to when it couldn't go forward in the appropriate area. What are the rules for when an ASH script will halt?
I'll have more questions as I delve...
The first thing I started working on was a not-a-pipe farming script that I could use in conjunction with regular adventuring. The idea is to constantly farm not-a-pipes while doing other things (such as powerleveling or farming something else). I had no trouble with identifying where in the absinthe cycle I was and adventuring properly at the various Wormwood locations.
However, when I tried to incorporate allowing for arbitrary adventuring, I ran into a problem with conditions. I don't have the exact script I was using at the time but the problem I was running into was that if I set conditions using cli_execute() and then adventured in a place for one adventure, if the conditions were not satisfied, the entire ASH script would halt, saying "Conditions not satisfied after 1 adventure," even if there was more script to run.
Here's some sample code that might illustrate better (reconstructed from memory, so it might have bugs, but the idea isn't that complex):
void main(int adv_ct, location otherloc, string conditions)
{
adv_ct = adv_ct - pipeadv(); //pipeadv does the right thing for the absinthe cycle and returns the number of adventures consumed while so doing
while (adv_ct > 0)
{
abs = have_effect($effect[Absinthe-Minded]);
while (abs != 9 && abs!= 5 && abs!=1)
{
cli_execute("conditions clear; conditions add " + string);
adventure(1,$location[otherloc]); //this halts if conditions aren't filled after 1 adventure.
adv_ct = adv_ct - 1;
abs = abs - 1;
}
adv_ct = adv_ct - pipeadv();
}
}
So the idea is to run this script with arguments of a number of adventures, a location, and some conditions, and stay Absinthe-Minded all the time, hitting the 9/5/1 absinthe adventures, and adventuring at otherloc until either adv_ct adventures are consumed total, or until conditions are met, and then halting. I figure that if this behavior is the way it's supposed to work, I can write a conditions parser and test the conditions myself after each adventure. This is probably more flexible but I dont want to do that if I'm just missing something obvious.
Second, something similar caused a problem for me when I tried, for example, to do the Cyrpt quest; only now it was that once I cleared the area, the script got caught in an infinite loop. This was due to somewhat lame scripting on my part, but in light of the halting when conditions weren't met above, I kind of expected the script to when it couldn't go forward in the appropriate area. What are the rules for when an ASH script will halt?
I'll have more questions as I delve...
