Re: CLI: Detecting Spookyraven Manor

Metraxis

Member
Re: CLI: Detecting Spookyraven Manor

I detect Spookyraven as follows:

Code:
contains_text(visit_url("town_right.php"),"manor.php");

You can save a server-hit by prefacing this with a check for any Spookyraven-specific drops in inventory, but unless you confine this check to Quest Items, it's not going to be reliable for Softcore players.

The problem of the stairs, however, is far more intractable. I don't know of any way other than checking for upstairs Quest Items to be sure the stairs are there without risking a fall/wasting a pageview, nor am I aware of a good way to fix the stairs from within ASH.
 
Re: CLI: Detecting Spookyraven Manor

[quote author=Metraxis link=topic=697.msg3234#msg3234 date=1168329780]
I detect Spookyraven as follows:

Code:
contains_text(visit_url("town_right.php"),"manor.php");

You can save a server-hit by prefacing this with a check for any Spookyraven-specific drops in inventory, but unless you confine this check to Quest Items, it's not going to be reliable for Softcore players.

The problem of the stairs, however, is far more intractable. I don't know of any way other than checking for upstairs Quest Items to be sure the stairs are there without risking a fall/wasting a pageview, nor am I aware of a good way to fix the stairs from within ASH.
[/quote]

He is requesting a cli method of opening the manor like
bogus non working sample.txt
Code:
conditions add manor open
adventure * Haunted Pantry

A full work-around:

open_manor.ash
Code:
while(!contains_text(visit_url("town_right.php"),"manor.php"))
{
adventure(1, $location[Haunted Pantry]);
}
is a complete ash script which should do it, but hits the server between every adventure.

add to current cli script
Code:
call open_manor.ash

fulfill any other conditions for the haunted pantry before calling this script from your cli script. If the manor is open at this point, the script should do nothing (may report "script failed" but that should be ignored). If the manor is not open, it will either open it, or burn all your adventures trying.

This is still not what is wanted though. It is a work-around.
 

macman104

Member
Re: CLI: Detecting Spookyraven Manor

For the pool cue, you can add that as a condition, then just "add conditions 1 pool cue", and then once that conditions is met, then you can add the choice adventure "add conditions 1 choice", while you may get the wrong choice adventure, at least it'll still adventure until you get atleast *a* choice adventure
 

macman104

Member
Re: CLI: Detecting Spookyraven Manor

Ah right, the gallery quest, that's where the choice adventure comes in, my bad.
 
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]);
 
Re: CLI: Detecting Spookyraven Manor

Minimizing is cool! I'm trying to use more cli scripts myself, but most of them will call small ash scripts rather than try to avoid ash all together. I can understand the part about trying to do things you don't have time to do also. I find myself doing that a lot! I'm trying to work on a bunch of scripts right now which I don't really have time to work on.
 
Top