Slime Tube Adventuring Script

Bazaaretw

Member
I'm having an issue with it not using my Squamous Gibberer instead of my Potato, in the Vars it says, "zlib SlimeTube_min_ml_familiar = Squamous Gibberer" but it just switches it to potato this is when I'm in mafia, but when I run it in relay is works as intented and brings out Squamous Gibberer.

But I can't run it in relay becasue I often get this error.

Code:
Casting Tongue of the Walrus 27 times...
You gain 926 hit points
Tongue of the Walrus was successfully cast.
You lose an effect: Coated in Slime
Putting on minml...
Equipment changed.
Putting Purse Rat the Purse Rat back into terrarium...
Taking Squamous Gibberer! the Squamous Gibberer out of terrarium...
moveable feast is better than (none). Switching items...
Stealing moveable feast from Purse Rat the Purse Rat...
Putting on moveable feast...
Equipment changed.
Resetting mind control device...
Mind control device reset.
Changing auto-attack: disabled
Fight.php returned a blank response!
 

slyz

Developer
The original slime.ash uses either the values edited directly in the ash file, either the Mafia goodkitty and badkitty properties.

Bale's relay version of slime.ash uses either the zlib variables SlimeTube_max_ml_familiar and SlimeTube_min_ml_familiar, or the Mafia goodkitty and badkitty properties.

In both cases, the kitty preferences take precedence.

Concerning the mysterious blank response problem, my posts must be confusing: see this last one.
 

slyz

Developer
I will not post links to my solution anymore. If you come here to post about a problem, then probably someone else was having the same problem. Maybe someone even offered a solution. Perhaps checking the last 2/3 pages of the thread would save everyone some time.
 

jambosque

New member
The following wasn't properly recognizing that -100 ML could be reached:

Code:
int extra_ml = ( bladders * 20 + numeric_modifier( "Monster Level" ) ) % 100;
			switch
			{
			case my_familiar() == $familiar[O.A.F.]:
				break;
			case extra_ml <= current_mcd():
				change_mcd( 0 );
				break;
			case extra_ml <= numeric_modifier( "ur-kel's aria of annoyance" , "Monster Level" ) && have_skill( $skill[Ur-Kel's Aria of Annoyance] ):
				cli_execute( "uneffect Ur-kels" );
				break;
			case extra_ml <= current_mcd() + numeric_modifier( "ur-kel's aria of annoyance" , "Monster Level" ) && have_skill( $skill[Ur-Kel's Aria of Annoyance] ):
				cli_execute( "uneffect Ur-kels" );
				change_mcd( 0 );
			}

I believe this should correct the negative modulus problem for those relying on safety headphones:

Code:
int extra_ml = ( bladders * 20 + numeric_modifier( "Monster Level" ) ) % 100;
[b]if(extra_ml<0) extra_ml = extra_ml +100; // correcting negative values of extra_ml[/b]
			switch
			{
			case my_familiar() == $familiar[O.A.F.]:
				break;
			case extra_ml <= current_mcd():
				change_mcd( 0 );
				break;
			case extra_ml <= numeric_modifier( "ur-kel's aria of annoyance" , "Monster Level" ) && have_skill( $skill[Ur-Kel's Aria of Annoyance] ):
				cli_execute( "uneffect Ur-kels" );
				break;
			case extra_ml <= current_mcd() + numeric_modifier( "ur-kel's aria of annoyance" , "Monster Level" ) && have_skill( $skill[Ur-Kel's Aria of Annoyance] ):
				cli_execute( "uneffect Ur-kels" );
				change_mcd( 0 );
			}
 

slyz

Developer
See Heeheehee's post. His solution is to change that line to:
PHP:
int extra_ml = ( bladders * 20 + numeric_modifier( "Monster Level" ) + 200) % 100;
 

Theraze

Active member
For that matter, could set the + 200 up to + 1000 or anything higher, just so it guarantees you have a positive end-result.
 

jambosque

New member
Ah...I should have read more of the thread, then.

My initial coding solution was similar to that (I only added 100), but then I decided I might as well code it so it would work no matter how negative the ML happened to be.
 

Theraze

Active member
Well, if you wanted to really do that, you should have done it as a while statement, not an if. :) Make it a while, and it doesn't matter if it's 100 or 500 it needs to add, it'll do it...
 

slyz

Developer
No, jambosque's solution works perfectly:
Code:
> ashq int a = -20; int b = a % 100; print(b);

-20
a % 100 should be 80: you can either add a multiple of 100 to a, or add 100 to b to get the correct result:
Code:
> ashq int a = -20; int b = a % 100; print(b); print(b+100);

-20
80
 

Theraze

Active member
True, I wasn't working through that it'd already been piped with a % 100. :) Teach me to try to think on Sundays. Ha! What's worse is trying to code on Sundays... getting tempted by the lack of updates to try to make myself a custom jar with the BM skill updates.
 

jambosque

New member
Well, if you wanted to really do that, you should have done it as a while statement, not an if. :) Make it a while, and it doesn't matter if it's 100 or 500 it needs to add, it'll do it...

No need for a while statement, because of the mod operator -- the problem was that the mod operator tends to be implemented such that modding by a particular value will give something in the range [-value,0) when the thing being modded is negative, instead of the [0,value) that would usually be expected.
 

Veracity

Developer
Staff member
the problem was that the mod operator tends to be implemented such that modding by a particular value will give something in the range [-value,0) when the thing being modded is negative, instead of the [0,value) that would usually be expected.
In which case you need to adjust your expectations.

ASH passes through Java's interpretation of % - which is mathematically consistent. Deal with it.
 

jambosque

New member
My apologies, Veracity -- what I said was not intended as complaint or criticism.

C++ has the same behavior (at least on the gcc c++ compiler), and I'd learned about it during a project involving dynamic memory and modding of array indices. There were a few crashes before I realized that I should check whether % was doing what I'd assumed it was doing... :)

But yes, I agree that once something is understood it's a matter of adjusting to it.

Also, I just realized that I'd been doubly ninja'd before I posted that...
 

xKiv

Active member
In which case you need to adjust your expectations.

ASH passes through Java's interpretation of % - which is mathematically consistent. Deal with it.

That doesn't really say *why*. So I asked uncle Google ...
Problem is when people expect % to be a "modulo" operator, when it's actually a "remainder" operator ... in some programming languages ... and then it's only consistent this way when integer division rounds towards zero ...
.. ugh.
I guess this should be noted on http://wiki.kolmafia.us/index.php?title=Operators ?
As in "/ - division - performs division rounded toward zero" and "% - remainder - ..."
 
Last edited by a moderator:

moooo566

New member
It changes outfits to get the most turns of covered in slime, but will it then change back for +ML? I'd try It, but I'm halfway through a speedrun. Just lookinjg for ways to speed it up.
Just to clarifym does it:
Change to low +ML outfit
get coated in slime (but then run away/tatter/cleesh to avoid using a tube turn)
Switch back to high ML
Use a chamois when running unable to survive
Change to low ML outfit
Rinse and repeat

EDIT: Ignore me. I didn't read properly.
 

hairyannie

New member
This is the first full-auto script i've run, so I don't know if my question is really about scripts in general:

How do you make it stop?

I started the script then realized I didn't have enough buffs set in my mood. I typed "abort" in the CLI, it announced "KOLMafia declares world peace" and went red. moments later i noticed the script kept running. I clicked "stop now", same result. I closed the relay browser, still the script continued running. Finally i just logged out. I hope that stopped it! I'm using the relay version with the manual fix for it returning blank fight pages.

Thanks so much to the authors and debuggers of this script, it is really awesome!
 
Top