Re: CLI: Detecting Spookyraven Manor
[quote author=Alexander Daychilde link=topic=697.msg3238#msg3238 date=1168337445]
Hmm... I appreciate the workaround offered - but there's no way I'm going to send double hits to KoL... heh.
The next-less lazy thing to do is:
1. Open mini-browser and browse to the proper side of the tracks
2. Adventure 5 haunted pantry
3. Refresh the mini browser to see if it changed to the manor. If not, repeat step 2
heh.
And you "waste" 5 turns at most... And usually it's pretty quick - just not always... Like today for me. heh.
[/quote]
simple,
openmanor.ash
Code:
while(!contains_text(visit_url("town_right.php"),"manor.php"))
{
adventure(5, $location[Haunted Pantry]);
}
does the same. but you do not manually have to refresh the mini browser. The only difference between it and the first version is it spends 5 adventures in the pantry instead of 1 before checking again.
[quote author=Alexander Daychilde link=topic=697.msg3238#msg3238 date=1168337445]
If I can talk Hola into this one, I have a couple of more I'd love (like cli "if weapon != pool cue; equip pool cue") :-D
[/quote]
from the scripting wiki:
In July of 2006, Holatuwol challenged the scripting community to pick up the gauntlet of ASH training, and he was right to have done so.
I'm doing my best to do just that, and what you are wanting is simple in ash using
boolean have_equipped( item it )
Code:
if( !have_equipped( $item[pool cue] ) )
{
equip( $item[pool cue] );
}
Just because you often see all the massive ash scripts posted here does not mean one has to be. The above code can easily be placed in it's own ash script in which that is all it does. You can then call that ash script from your cli script and you have what you want. This is how I started scripting in ash except at that time I had to wrap it all in a "void main() {..code..}" wrapper. Writing ash scripts
like that may seem like a waste at first, but soon enough you will better understand ash and start to put the whole picture together and have 1 ash script that does it all.
It would seem to me that the request if granted would really just add more unneeded work for Holatuwol and Veracity when it's simple enough using ash scripts called by cli scripts.
here is your current cli script converted to ash
Code:
cli_execute("conditions clear;");
add_item_condition( 1, $item[pool cue] );
add_item_condition( 1, $item[handful of hand chalk] );
adventure( my_adventures(), $location[haunted billiards room]);
equip( $item[pool cue] );
use( 1, $item[hand chalk] );
cli_execute("conditions clear");
add_item_condition( 1, $item[spookyraven library key] );
adventure( 5, $location[haunted billiards room]);
and here it is with the equipped check added:
Code:
cli_execute("conditions clear;");
add_item_condition( 1, $item[pool cue] );
add_item_condition( 1, $item[handful of hand chalk] );
adventure( my_adventures(), $location[haunted billiards room]);
if( !have_equipped( $item[pool cue] ) )
{
equip( $item[pool cue] );
}
use( 1, $item[hand chalk] );
cli_execute("conditions clear");
add_item_condition( 1, $item[spookyraven library key] );
adventure( 5, $location[haunted billiards room]);
toss in the opening of the manor (with a check for open every 5 adventures):
Code:
while(!contains_text(visit_url("town_right.php"),"manor.php"))
{
adventure(5, $location[Haunted Pantry]);
}
cli_execute("conditions clear;");
add_item_condition( 1, $item[pool cue] );
add_item_condition( 1, $item[handful of hand chalk] );
adventure( my_adventures(), $location[haunted billiards room]);
if( !have_equipped( $item[pool cue] ) )
{
equip( $item[pool cue] );
}
use( 1, $item[hand chalk] );
cli_execute("conditions clear");
add_item_condition( 1, $item[spookyraven library key] );
adventure( 5, $location[haunted billiards room]);