Slime Tube Adventuring Script

Does this happen with the non relay version of the script?

Yes. It started happening to me with the non-relay version initially, which is what prompted me to switch to the relay version initially. Since I had been using the non-relay version for weeks just fine, I can only guess something was tweaked with the game's combat?
 

heeheehee

Developer
Staff member
Mafia is indicating -100 ML right now, and with 5 bladders, extra_ml is equal to 0. It is 28 with -72 ML. Why would you need to add 200 ML?

In the event that you don't have 5 gallbladders squeezed? Yeah, I know, niche-y, but if your minml outfit gives -115 ML and you have Ur-Kel's running at level 30 (or any other level greater than 7, really), -55%100 is -55, not 45. As such, it won't shrug Ur-Kel's to get one more turn of Coated in Slime.
 

slyz

Developer
-55%100 is -55, not 45.
Ah right, I didn't see the case where the total ML is negative.

-------------------------------------------------------------------------------

On a very different subject, here's a little fix for the cases where a semi-rare is due and you have a counterScript setup. Mafia will then spend two adventures when adventure(1,$location[The Slime Tube]) is called, and slime.ash doesn't get a chance to check for Coated in Slime damage between those two turns.
  • First, check if a semi-rare is up, at the beginning of the main loop:
PHP:
boolean semirare = ( get_counters("Fortune Cookie",0,0) != "" ) ;
  • Next, instead of checking if slime_damage()>=my_maxhp(), check:
PHP:
if( slime_damage() >= my_maxhp() || ( semirare && have_effect( $effect[Coated in Slime]) > 0 && slime_damage( (have_effect( $effect[Coated in Slime])-1) ) < my_maxhp() ) )
This way, Coated in Slime will be removed a turn earlier if you know that Mafia is going to adventure twice instead of once. The check for have_effect($effect[Coated in Slime])>0 is necessary because slime_damage(-1) fails. This could be removed if this is added in slime_damage():
PHP:
if ( turns < 1 ) return 0;

  • To make sure the counterScript will trigger before adventuring to reslime, use this instead of visit_url(to_url($location[The Slime Tube])):
PHP:
adventure( 1 , $location[The Slime Tube] );
boolean combat = !( get_property("lastEncounter").contains_text("Engulfed") || get_property("lastEncounter").contains_text("Showdown") ) ;

Of course, a get_semirare setting could be used to override this (this could be used for slimeling runs, where loosing a turn of expensive buffs for a semi-rare might not be worth it).

EDIT: the combat boolean isn't really needed anymore, if visit_url() isn't used.
 
Last edited:

Darth Vidar

New member
Thanks for the script guys makes life a lot easier :D

I had a problem with it at first though but I managed to fix it. Just in case you wanted to fix it, the problem was that when the script changed my outfits to the "minml" outfit it didn't heal me when I needed it and I ended up dieing from slime burn every time it applied a new layer of slime. To correct this I made the script cast cocoon after switching outfits.

Thanks again
 

slyz

Developer
I think line 416 (of the non relay version) should be changed from
PHP:
if( !restore_hp( slime_damage() + 1 ) ) abort( "Can't restore enough HP!" );
to
PHP:
if( !restore_hp( slime_damage( coated_turns ) + 1 ) ) abort( "Can't restore enough HP!" );
 

orezprajit

New member
So, I'm getting the whole blank Fight.php thingy and thought I'd paste some of the relevant error log because I'm tired of trying to figure it out myself. Here goes:

Code:
Entering function print
<font color="blue">Adventure 7 out of 10</font>
                                    Function print returned: void
                                 [NORMAL] <- void
                           [NORMAL] <- true
                              Eval: visit_url()
                                 Param #1: to_url()
                                    Param #1: "The Slime Tube"
                                    [NORMAL] <- "The Slime Tube"
                                    Entering function to_url
                                    Function to_url returned: adventure.php?snarfblat=203
                                 [NORMAL] <- "adventure.php?snarfblat=203"
                                 Entering function visit_url
class net.sourceforge.kolmafia.request.RelayRequest
Connecting to adventure.php...

Requesting: http://www2.kingdomofloathing.com/adventure.php?snarfblat=203
4 request properties

Field: Cookie = [PHPSESSID=9q7p5dvrf1kpno07gk1or5uob4]
Field: Content-Length = [13]
Field: User-Agent = [KoLmafia v14.1]
Field: Content-Type = [application/x-www-form-urlencoded]

Retrieving server reply...

Retrieved: http://www2.kingdomofloathing.com/adventure.php?snarfblat=203

11 header fields
Field: null = [HTTP/1.1 302 Found]
Field: Date = [Wed, 21 Jul 2010 05:04:16 GMT]
Field: Content-Length = [0]
Field: Expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: Location = [fight.php?ireallymeanit=1279688656]
Field: Connection = [close]
Field: Content-Type = [text/html; charset=UTF-8]
Field: Server = [Apache/2.2.3 (CentOS)]
Field: X-Powered-By = [PHP/5.1.6]
Field: Cache-Control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
Field: Pragma = [no-cache]

                                 Function visit_url returned: 
                              Set: 
                           [NORMAL] <- ""
                              if
                              Test: contains_text()
                                 Param #1: page_text
                                 [NORMAL] <- ""
                                 Param #2: "Combat"
                                 [NORMAL] <- "Combat"
                                 Entering function contains_text
                                 Function contains_text returned: false
                              [NORMAL] <- false
                              else
                                    Eval: false
                                    Set: false
                                 [NORMAL] <- false
                           [NORMAL] <- true
                              Eval: run_adv()
                                 Param #1: page_text
                                 [NORMAL] <- ""
                                 Entering function run_adv
                                       if
                                       Test: ( page_text == "" )
                                          Operator: ==
                                             Operand 1: page_text
                                             [NORMAL] <- ""
                                             Operand 2: 
                                             [NORMAL] <- ""
                                          <- true
                                       [NORMAL] <- true
                                             Param #1: "Fight.php returned a blank response!"
                                             [NORMAL] <- "Fight.php returned a blank response!"
                                             Entering function abort
Fight.php returned a blank response!
                                             Function abort returned: void
                                          [EXIT] <- void
                                    [EXIT] <- void
                                 Function run_adv returned: 
                              Set: 
                           [EXIT] <- void
                     [EXIT] <- void
               [EXIT] <- void
            Function run_tube returned: void
         [EXIT] <- void
   [EXIT] <- void

[6671] The Slime Tube

> debug off
 

slyz

Developer
Maybe adventure() should be captured in some way so that the error doesn't stop the script (assuming it doesn't happen on every adventure of course). Try replacing
PHP:
adventure( 1 , $location[The Slime Tube] );
adv_to_use = adv_to_use - 1;
at the end by
PHP:
if ( adventure( 1 , $location[The Slime Tube] ) )
	adv_to_use = adv_to_use - 1;


-------------------------------------------------------------------------------
EDIT:

  • To make sure the counterScript will trigger before adventuring to reslime, use this instead of visit_url(to_url($location[The Slime Tube])):
PHP:
adventure( 1 , $location[The Slime Tube] );
boolean combat = !( get_property("lastEncounter").contains_text("Engulfed") || get_property("lastEncounter").contains_text("Showdown") ) ;
Regarding my fix to not get killed when getting semirares, adv1() should be used instead of adventure(), so the fix would be:
PHP:
adv1($location[slime tube], -1, "");
boolean combat = !( get_property("lastEncounter").contains_text("Engulfed") || get_property("lastEncounter").contains_text("Showdown") ) ;

I finally tested this with free runaways (Bander ones, but the same problem would appear with tatters etc...), and of course Mafia would keep using free runaways until it could finally spend an adventure in the tube. adv1() fixes that.
 
Last edited:

xKiv

Active member
Maybe adventure() should be captured in some way so that the error doesn't stop the script (assuming it doesn't happen on every adventure of course). Try replacing
PHP:
adventure( 1 , $location[The Slime Tube] );
adv_to_use = adv_to_use - 1;
at the end by
PHP:
if ( adventure( 1 , $location[The Slime Tube] ) )
	adv_to_use = adv_to_use - 1;

Actually, isn't it more matter of
Code:
	page_text = visit_url( to_url( $location[The Slime Tube] ) );

not following a HTTP redirect (code 302)?

ETA: or maybe you weren't responding to orezprajit, in which case I should have quoted that post instead?
 
Last edited:

slyz

Developer
I hadn't even looked at orezprajit's debug log (and apparently, on this one the problem appears on the visit_url() ), I was just trying to find a possible solution.

I'm not really sure why run_adv() is still needed (although it is a nice function), since setting the properties from inside the script would make sure the script doesn't start fighting the Mother over and over again. Maybe it could be replaced with adv1(), and maybe capturing adv1() would prevent the script from stopping in these cases.

I'm not really sure what a HTTP redirect means... I'm guessing it means that it's not Mafia's fault?
 
I'm not really sure what a HTTP redirect means... I'm guessing it means that it's not Mafia's fault?

I'm 90% sure it's some sort of change to the game that is causing the problem I'm having with the script. It worked fine for weeks straight using the same version of mafia and the script, but suddenly stopped working despite me changing neither the version of mafia or slime.ash. Or changing the version of any other scripts for that matter.
 

xKiv

Active member
I'm not really sure what a HTTP redirect means... I'm guessing it means that it's not Mafia's fault?

It means "I know what you want, but it isn't here - go to this other URL to get it".
In this case, the redirect is from "adventure.php?snarfblat=203" to "fight.php?ireallymeanit=1279688656", which is how fights have been handled, like, forever (for values of forever shorter than two years?), no?

visit_url just returns what the first url contains (redirect in headers, no body - and visit_url doesn't seem to return the headers).
Then run_adv says "Fight.php returned blank page", but that's hardcoded message, it doesn't mean the script actually asked to visit fight.php ...
 

Terrabull

Member
DA: I don't think it's a game problem, because I can still use the non-relay version of the script (and so can my clan-mates.)
Try re-downloading the .ash and running that specifically. It might error once or twice, but just restart the script and it should be fine.
 

slyz

Developer
Or the script should use adv1() instead of run_adv(), and force the Mother Slime noncombat to the Show in Browser option, by adding
PHP:
set_property("choiceAdventure326","0");
somewhere in the beginning of the script.
 

Bale

Minion
Or the script should use adv1() instead of run_adv(),

That would be good. The script was written before jason added adv1() to ASH and Alhifar had an awesome work-around, but I suspect that the time to use adv1() has arrived.
 
Ok, so I've read through a bunch of this thread, but my n00bish question still persists:

Everything in the script works fine except for when it switches to my min_ml outfit and changes mcd etc., it always returns an error with "Fight.php returned a blank response!".

Whenever this happens, I'm actually IN a fight with a weaker slime- I can click on other things and it loads the battle page.

Sorry for my fail!
 
This is a recent problem the script has developed for many, myself included. I haven't seen a good workaround aside from manually tattering then rerunning the script.
 

slyz

Developer
I haven't seen a good workaround.

Apparently I wasn't very clear in my posts.

Concerning the "Fight.php returned a blank response!", I don't know the cause, but maybe a solution would be to replace these lines (508-511 in Relay_slime.ash or 420-423 in slime.ash)
PHP:
page_text = visit_url( to_url( $location[The Slime Tube] ) );
if( page_text.contains_text( "Combat" ) ) combat = true;
else combat = false;
page_text = run_adv( page_text );
by
PHP:
adv1($location[slime tube], -1, "");
boolean combat = !( get_property("lastEncounter").contains_text("Engulfed") || get_property("lastEncounter").contains_text("Showdown") ) ;

You might also want to add this line near the top of the script, to make sure Mafia will abort when the Showdown adventure is encountered:
PHP:
set_property("choiceAdventure326","0");
 
Top