Aborting during prePVPScrtip

matt.chugg

Moderator
Is there away to stop mafia completely BEFORE commencing the fight?

Code:
print("Aborting Fight");
abort();

This causes mafia to declare peace, but only aborts the current script, not the calling thread. (Does world peace, indicate GLOBAL abort of everything?)

Code:
> pvp 1 flowers

Use 1 PVP attacks to steal flowers via best stat
Aborting Fight
KoLmafia declares world peace.
You acquire an item: pretty flower
You gain a little swagger
You challenged Ibex and won the PvP fight, 4 to 2!
 

lostcalpolydude

Developer
Staff member
Probably what's needed (though I'm not completely sure since I haven't accounted for it anywhere in my previous code) is to check mafia's current state before actually running through each fight, which I imagine means setting mafia to a CONTINUE state before the first iteration.

I don't think there's anything that you can currently do from a script, and I think that what you tried to do should eventually work.
 

roippi

Developer
Presumably we should check for an ABORT state on exit from the beforePVPscript, stopping there if so. A failed equipment swap or what have you should still unwind the pvp request.
 

lostcalpolydude

Developer
Staff member
If you had tried to use all of your fights, it would have only used one of them since the check was after the fight being used rather than after the script is run. 11734 adds a check between the script running and a fight being used, in addition to the check after a fight is used (in case you want to stop there with Escape and not run your script again).
 
Top