Bug - Fixed Tavern Cellar infinite loop

Cheap shot and not the kind of comment that encourages people to actually give a rat's tootie (*snicker*) about your questions.

Excuse me? After having extensively googled to try to find even very basic ash scripting information and coming up with nothing (And yes, I've seen the crap wiki before, as well as those supposed introductions, both were less than helpful), and eventually resorting pilfering other people's scripts to figure out how to do so much as adventure somewhere and visit a url, I think that I'm quite entitled to say that the documentation is, for all intents and purposes, nonexistent. Furthermore, earlier in the thread somebody claimed that writing a script to solve this problem was "Very easy to do". This is a flat out lie, but when I commented about how not easy it was, and how the average user should not even need to worry about this, I was basically told "Lol, u r dooing it rong." I'm bound to get a little pissed at that.

I stand by what I said. If that means that I'm some blind idiot in your eyes, then screw it. Unfortunately for you, a documentation that does not help is functionally equivalent to a nonexistent one. And I especially don't care to be told that something is easy when it is, in truth, far from it. Too bad both times that I tried to demonstrate that the point was completely and utterly missed.
 
Last edited:

roippi

Developer
crap wiki

That "crap wiki" is maintained entirely by volunteers. It is, in fact a communal effort, so any deficiencies are as much your fault as anyone else's.

I'm going to take some initiative and lock this thread for a bit. A very handy script solution was posted to help you. No bug-related discussion is happening anymore.

I suggest you cool down and review this matter at a later time. Your criticisms of the documentation are perhaps valid in places, misguided in some other places, entirely unfounded in yet other places, but in all places will likely be seen as a personal attack by several people who are responsible for generating said documentation. Take more care in the future.

ETA: reopening.
 
Last edited:

Theraze

Active member
Might have a patch for this, but since I'm fully overdrunk can't be sure yet if it works. I'll try to remember to run an adventure there tonight. If it works, should function like this:
1) If there's an unexplored square, go there first. I think the only 'special' square left after the faucet is the Baron, and that doesn't cost an adventure if you leave, so finding that is a good thing.
2) If not, and you've found the faucet, go there.
3) If somehow you've broken your preference so there are no unknown squares left and there's no faucet, update the display with an error message to let them know and abort adventuring.

Anyways, we'll see. The negative would be if this makes it auto-adventure anytime you visit the cellar... that's what I need to check. :D If so, I'll try to see if I can make the auto-adventuring pass along an extra value for us to notice.

Edit: Visiting the cellar registers as a visit, but doesn't redirect, so that seems proper so far... least that eliminates my first "revert! revert! revert!" check. :)
 
Last edited:

Theraze

Active member
Request 1 of 2 (Woods: Tavern Cellar) in progress...

[542] Tavern Cellar (row 2, col 3)

Request 2 of 2 (Woods: Tavern Cellar) in progress...

[543] Tavern Cellar (row 2, col 4)

Requests complete.

So... looks like it works fine now. It explored all the squares, then went to the faucet automatically. As per this:
Request 9 of 10 (Woods: Tavern Cellar) in progress...

[552] Tavern Cellar (row 5, col 5)
Encounter: drunken rat

Request 10 of 10 (Woods: Tavern Cellar) in progress...

[553] Tavern Cellar (row 4, col 2)
Encounter: Hot and Cold Running Rats
Encounter: drunken rat

Requests complete.

Note that this is not as smart as the official Tavern solver... I still suggest using that first. But if you just want to farm whiskers after, this does make it work. And it'll eventually find the mansion as well, so that's a bonus, since the tavern(boolean) function never did happen. :)
 

Attachments

  • TavernAdventure.patch
    946 bytes · Views: 30

telepanda

New member
Sorry, noob question

I had forgotten about that preference!

"tavernLayout" is a Mafia preference where the layout of the tavern is stored:
Code:
> get tavernLayout

1511110000200001000011113
where:
Code:
0 = Darkness
1 = Explored / Stairs Up
2 = Dead adventurer
3 = A Rat Faucet
4 = A Tiny Mansion
5 = Various Barrels
If you want to find visit the square with the Faucet, you simply need to do:


PHP:
int faucet = 1 + get_property( "tavernLayout" ).index_of( "3" );
if ( faucet < 1 ) abort( "Mafia doesn't know where the Faucet is." );

void squeeze_rat() {
	visit_url( "cellar.php?action=explore&whichspot=faucet" );
	visit_url( "choice.php?whichchoice=512&option=1" );
	run_combat();
}

When you say, "Simply need to do".... How exactly do you use the script? I'm fairly new to advanced Mafia, and this is my first foray into scripting. But manual rat-farming is getting pretty old here...

Thanks ever so much.
 

lostcalpolydude

Developer
Staff member
Using a plain text editor (Notepad, Notepad++ if you use it, not Word or other fancy programs though), copy that code in and save it as whatever.ash. Then use the Scripts menu to tell mafia to run the script.
 

Winterbay

Active member
Using a plain text editor (Notepad, Notepad++ if you use it, not Word or other fancy programs though), copy that code in and save it as whatever.ash. Then use the Scripts menu to tell mafia to run the script.

Save it in the folder called "scripts" as well, otherwise it won't show up in that menu.
 

Theraze

Active member
Well, the patch does allow adventuring... but it breaks the tavern solver's automatic non-adventuring visit to the tavern to wipe the preference.

Solutions:
1) Make the tavern solver check somehow besides outside adventure request.
2) Make adventuring actually pass along the square there, so the fact that it's not included as per normal doesn't break things.

I'll probably experiment with solution 2 more. When I have a non-fully-adventured/tavern-solved character again. :)
 

lostcalpolydude

Developer
Staff member
First you need to be compiling mafia yourself, as explained here. Then you need a program that can apply the patch for you; TortoiseSVN is a common option for Windows, I believe.
 

Theraze

Active member
Additional sidenote on the patch... it's just a simple index match for unexplored squares. That means that if you run it straight, it will try to adventure in the upper left corner first. This won't be met with the best results...

Anyways, think I maybe might have it... put the code along with the extra dungeon code... but need another test or two, so... I'll have an updated patch after another few rollovers. I hope. :)
 

Theraze

Active member
Okay... this patch should be significantly better than the #24 patch. It doesn't break the tavern solver, but it allows automated adventuring. Not sure if I got the values right... think I did though. Should adventure through the unknown squares and then stick on the faucet. Took a page from the dungeon fist solver and made it check the return value on the adventure.
 

Theraze

Active member
That's because it's an INVISIBLE patch! Or... maybe because I screwed something else up. Meh. Could have sworn I told it to upload. Anyways, try this one. :D
 

Attachments

  • TavernAdventure.patch
    913 bytes · Views: 22

Theraze

Active member
Hmm... better, but it appears to still not be quite right. It adventured out 3 rows instead of 2, but still failed to get the complete series. I'll need to consider how to make it work better... possibly by turning it into tavern solver lite, and making it know that the first steps go left instead of right, etc. Will probably take more parsing and actually raise the patch over 1k, but... eh, working is better than brief. :)
 

Gdunge

Member
If you want to find visit the square with the Faucet, you simply need to do:


PHP:
int faucet = 1 + get_property( "tavernLayout" ).index_of( "3" );
if ( faucet < 1 ) abort( "Mafia doesn't know where the Faucet is." );

void squeeze_rat() {
	visit_url( "cellar.php?action=explore&whichspot=" + faucet );
	visit_url( "choice.php?whichchoice=512&option=1" );
	run_combat();
}

Another ASH n00b here. I finally have some time to play me some KoL, and the Way of the Surprising Fist makes me want to kill rats. Lots of rats.

So, I saved this script in a file called "ratfight.ash", located in my scripts folder. It shows up in mafia's Scripts menu. Good so far.

However, when I select "ratfight.ash" from the Scripts menu, I get the following result:

Code:
> call scripts/ratfight.ash

...and nothing else. Nothing seems to happen.

Now, I've noticed that the ASH scripts I've looked at all seem to have a "void main()" structure in them. (Edit: at least the ones that do stuff when the user executes them, like AutoClub.ash but not BatBrain.ash). The above script does not have one. Is this a problem?

Ideally, this functionality should be built into KoLmafia as others have pointed out, but in the meantime (or instead of, I'm not picky) I'd like to have a scripted solution that approximates the auto-adventure capability of mafia e.g. set adventure goal, set number of adventures, go. In this case, since you always get a whisker, that could be reduced to "set number of adventures, go".

Could someone help me out?

Thanks,

Gdunge
 
Last edited by a moderator:

Fluxxdog

Active member
A little buggy in the script. Check this out:
Code:
int faucet = 1 + get_property( "tavernLayout" ).index_of( "3" );
if ( faucet < 1 ) abort( "Mafia doesn't know where the Faucet is." );

void squeeze_rat() {
    visit_url( "cellar.php?action=explore&whichspot="+faucet );
    visit_url( "choice.php?whichchoice=512&option=1" );
    run_combat();
}

void main(){
    squeeze_rat();
}
The faucet should be added on to the end of the string instead of inside the quotes.

void main() is the function that executes when you run the script directly. If you imported the script elsewhere, it'll ignore the main() function and use everything else as is. This way, you could use squeeze_rat() in another script.
 
Last edited:

Theraze

Active member
More complicated, but this patch actually works...
 

Attachments

  • TavernAdventure.patch
    2.2 KB · Views: 20
Top