Winterbay's Helpful Automatic Monsterbasher (WHAM)

Winterbay

Active member
I was wondering if you have considered making this script work with Ed the undying so that it recognizes that monsters can have flyers used on them three times per combat and recognize that HP is much less important than MP in the first two fights?

If someone has the time to work on that it would be great. Unfortunately I don't have that :(
Need to look into letting other people have access to checking in things...
 

fewyn

Administrator
Staff member
Not sure if this belongs here... batbrain or zlib but right now WHAM doesn't work at all for me.

Code:
[COLOR=red]Expression syntax errors for 'modifier_eval()':
Can't     understand bringuprear,3+min(0.0,25)+0.0)
Expected ,, found
Unexpected     end of expr
Expected ), found (zlib.ash, line 188)[/COLOR]
 

AssHandy

Member
So... I'm a very low-skill newish player. I've ascended maybe 5 or so times. I've been using WHAM and BCA to automate ascensions, but the OCRS path is giving WHAM all sorts of problems - it can never figure out a good strategy as a low skill moxie class vs. things like 'electrified' or 'cloned' etc. I usually have to go in and use CLEESH manually and then rerun BCA to continue.

Can I ask the script to attempt to CLEESH if no solution is found, thus maintaining my automation?

Thanks!
 
Last edited:

adeyke

Member
I have a lot of skills permed, but even I have trouble with a lot of OCRS fights. I'd just been losing those fights, having entirely forgotten about CLEESH.
 

Crowther

Active member
You could adjust your custom combat script to recognize certain modifiers and CLEESH automatically. Maybe if you put "CLEESH" after "consult WHAM.ash" it might run that if WHAM quit, but if WHAM aborts, maybe not.

adeyke is right, even with lots of skills some combinations of modifiers are simply impossible to kill. For example, I've had annoying monsters where I was not able to complete a single action before losing the fight. Not much WHAM or anyone can dot there.

The best thing about CLEESH is it rerolls the modifiers. So deciding to CLEESH or not can be a bit complex with optimal and clingy. Newt, etc are never clingy, which really helps.
 

AssHandy

Member
So it isn't possible to get the script to CLEESH instead of abort? That would get rid of about 90% of the interruptions to my automation.
 

fronobulax

Developer
Staff member
So it isn't possible to get the script to CLEESH instead of abort? That would get rid of about 90% of the interruptions to my automation.

I wouldn't say it is impossible, but if the script is changed then every user will have to live with that change. That might not be a good thing in the sense that the script would still fail automation if (for whatever reason) the character did not have CLEESH (and there are such characters). Some folks might prefer to runaway and have the items and skills to make that a reasonable choice.

That said it would be nice to understand the current WHAM behavior when it can't figure something out. If it always exits in a way that the next line in a CCS is executed, individuals could handle the exit any way they wanted.
 

Theraze

Active member
In most aborts, a stun and some sauce/belch hits win. Very rarely (untouchable/annoying +ticking) is Cleesh the only way to finish successfully.
 

AssHandy

Member
I'm playing very low skill. I don't have that many hardcore permed skills.

Getting the script to abort if it is the last line in a CCS or run the next line of the CCS if it is not the last line, on failure, sounds like a good move? I wish I knew how to do this sort of stuff myself.
 

fronobulax

Developer
Staff member
The wiki says about consult scripts in a CCS
When it finishes executing, if the monster is not yet dead, then the CCS will continue combat from the current round.

so the question becomes whether there is anything WHAM is doing that would cause KoLmafia to bypass this control flow? If not then a CCS will address all of the concerns.

Having asked that I know there are cases where WHAM can't figure out something to do and I effectively get dumped into the relay browser to handle it myself. What I don't know whether that is the result of a WHAM setting I have set, or my CCS running out of things to try or what.
 

AssHandy

Member
What command could it use, otherwise?

Hmm. There isn't a relay script for WHAM, right? So making a toggle for: ABORT if no solution found/CONTINUE CCS if no solution found is probably more difficult?
 

fronobulax

Developer
Staff member
WHAM uses abort() to quit. That makes mafia quit automation.

Feature Request for WHAM: Provide a user toggle that determines whether WHAM aborts when it cannot figure out what to do or just exits, thus passing control to the next line in a user CCS.

Comment: I would apply this just to the case where WHAM can't figure out what to do. If WHAM wants to abort because of the round count or other conditions it should still be allowed to do so without regard to this new toggle.

Extra Credit: If the toggle is implemented and set in favor of continuing, log the monster encountered plus the options WHAM considered and found unsatisfactory by appending to a file WHAM_Spade_Opportunities.txt I suspect that would increase the number of people who are willing to help improve WHAM (and implicitly BatBrain's data) by reporting failures with enough information to make an after the fact diagnosis feasible.
 

Veracity

Developer
Staff member
What command could it use, otherwise?
exit.

That is like "return" or "break" or "continue" - a way to break out of your current control construct - except it breaks all the way out of the script, unwinding through try/finally blocks as normal.

Actually, looking at the code, abort() does the same thing - it sets interpreter state to EXIT, which behaves as above - but also sets KoLmafia's global state to ABORT.
 

Veracity

Developer
Staff member
Actually, looking more closely at Try.java:

Code:
		finally
		{
			if ( this.finalClause != null )
			{
				String oldState = interpreter.getState();
				interpreter.setState( Interpreter.STATE_NORMAL );
				KoLmafia.forceContinue();
				if ( interpreter.isTracing() )
				{
					interpreter.trace( "Entering finally, saved state: " + oldState );
				}
				Value newResult = this.finalClause.execute( interpreter );
				if ( interpreter.getState() == Interpreter.STATE_NORMAL )
				{
					interpreter.setState( oldState );
				}
				else
				{
					result = newResult;
				}
			}
		}
When we go through a "finally" block, we do this before executing the block:

Code:
				interpreter.setState( Interpreter.STATE_NORMAL );
				KoLmafia.forceContinue();
(set the interpret state to NORMAL and set KoLmafia's global state to CONTINUE) and when it is done, we reset the interpreter state, but leave KoLmafia's global state to whatever it ends up as.

That doesn't seem right.
 

Crowther

Active member
WHAM has a function called quit() it calls vprint() from zlib.ash with a level of 0. 0 causes vprint() to return false, which then causes WHAM to abort, since it is not assigned anywhere.

I changed "vprint(input, 0);" to "vprint(input, 1); exit;" and after WHAM finished the next line of my CCS was executed.
 
Top