Equipment reverting after using Adventure()

I can't find any documentation on this feature, but it seems from my experience with the adventure() function that mafia is setting a checkpoint for my outfit before adventuring and is reverting to that outfit when it is done executing my requested adventures. I handle my equipment with a between battle script, which seems to trigger *after* mafia sets the equipment checkpoint. In some of my scripts, where setting the goal is difficult, I have been using a while loop and adventuring once at a time. As a result, mafia is changing my clothes back to the checkpoint and then re-equipping my location-specific outfit after every single adventure. While this isn't the end of the world, it slows down my scripts and I feel bad for the excessive server hits.

Thus, my question: is there any way to turn off mafia's auto-reequip feature? Or am I using the program improperly such that this is not an issue for anyone else? Thanks.
 

Darzil

Developer
What is the between battle script? I don't use one and this doesn't happen for me. If you (temporarily) remove it, does the issue go away ?
 

Veracity

Developer
Staff member
My impression is that we execute the betweenBattleScript before each iteration and the afterAdventureScript after each iteration. I am also under the impression that the equipment checkpoint is set around the entire sequence of adventures. (I sure wish we had implemented both scripts at the same time so they could be the "beforeAdventureScript" and the "afterAdventureScript". But, backwards compatibility...)

It appears that your experience agrees with what I said, since you specifically mention manually looping one adventure at a time - which is to say, the "entire sequence" is a single adventure.

In other words, it sounds like it is behaving correctly, given how you are using the function.

The question is, why are you manually looping one adventure at a time rather than telling KoLmafia to loop multiple times. You say it is because "setting the goal is difficult". Can you explain what you mean by that? Examples? Perhaps there is a better way to achieve what you want.

(Alternatively, if your goal requires going to the same location repeatedly, perhaps your outer script can set the outfit, rather than the betweenBattleScript?)
 
What is the between battle script? I don't use one and this doesn't happen for me. If you (temporarily) remove it, does the issue go away ?

In general I use zarqon's bestBetweenBattle script, and I also have a custom function that I have the BBB call that uses a long switch statement to equip the proper gear for my location and situation. If I turned off those scripts that would indeed fix the problem, but only inasmuch as I would not be equipping the correct gear for my adventuring location. Does that make sense?

Again, this might only be a problem with my (weird?) approach to equipping gear.

The question is, why are you manually looping one adventure at a time rather than telling KoLmafia to loop multiple times. You say it is because "setting the goal is difficult". Can you explain what you mean by that? Examples? Perhaps there is a better way to achieve what you want.

Yep, I imagine that part of this is my own failure of imagination with using the goal-oriented adventuring. I'm at work and can't remember all the specific examples. One that I recall is in the Black Forest, where I adventure once at a time and check to see whether the map contains the black market gif. Another is in starting the frat war, I check to see if the last adventure was "Blocking Out the Scenery" or whatever that noncom is called. I don't believe that those are autostops (at least they aren't listed on that wiki page), and I don't think there are default goals suggested for those events in mafia.

Although even when I use goal-oriented adventuring correctly, I don't really need mafia to checkpoint my gear and re-equip it for me, as I always just handle that myself. I'd rather be able to turn it off (or perhaps pass a true/false flag to the adventure() function).
 
Last edited:

slyz

Developer
I think you can game the system by adding a cli_execute( "checkpoint" ) in whatever script changes your equipment. That way, Mafia will silently try to equip the last checkpoint gear (the one you are currently wearing) once you are done adventuring.

I'm not 100% sure it will work though, and I don't have access to the source right now.
 
I think you can game the system by adding a cli_execute( "checkpoint" ) in whatever script changes your equipment. That way, Mafia will silently try to equip the last checkpoint gear (the one you are currently wearing) once you are done adventuring.

I'm not 100% sure it will work though, and I don't have access to the source right now.

Gosh, that is a good idea, which I really expected would work. Does not seem to, though.
 
Apologies for the bump. Should I add "disabling auto-reequip" as a feature request in the proper forum? Or has the idea already been considered and rejected?

As an aside, I'm a bit surprised more people haven't run into this problem! Using a betweenbattlescript to handle equipment seemed like such a natural fit to me. Or maybe people just don't mind the wasted server hits?
 

Veracity

Developer
Staff member
It's only a "wasted server hit" if you are adventuring one adventure at a time with a goal. As I said, the sequence is this:

outfit checkpoint
loop for X adventures or until condition is satisfied
-> between battle script
-> adventure once
restore checkpoint

If X is greater than 1, the loop stops when the condition is achieved or you do X adventures. The checkpoint save/restore happens around the whole sequence.

If X is 1, the loop stops after 1 adventure, regardless of goal, and the checkpoint save/restore happens around each adventure.

So, why are you adventuring one adventure at a time? You said something about "complicated goals", I asked for elaboration, and you said ... something. I did not understand your reply, so I moved on.

So, if your goals are "complicated" enough that you cannot achieve them with KoLmafia's built-in goals, and you might want to switch adventure locations after any given adventure, that implies that your script is checking for goal completion after each adventure and KoLmafia's internal goal handling is redundant. In which case, your script which is looping with adventure(1,...) and checking for goal completion after each such call should handle outfits.

The between battle script might a "natural fit" for outfits if you are running more than one adventure at a time in the GUI or via adventure(X,...), but for your use case, not so much.

Regarding "disable auto-reequip", I see it as undesirable for the "normal" use of doing multiple adventures at a time, and unnecessary for a script which has its own adventure loop, since such a script can handle equipment exactly as it desires and KoLmafia's outfit checkpoint/restore will not result in so much as a single server hit, since I don't believe it actually creates a KoL outfit for doing that.
 
I'm sorry if I came off as annoying or whiny Veracity - I seriously did not mean to. I just want to clarify something and I won't ever bump this again:

The between battle script might a "natural fit" for outfits if you are running more than one adventure at a time in the GUI or via adventure(X,...), but for your use case, not so much.

90% of the time I am doing just that (running multiple adventures at once). Once the adventure sequence is done, though, my equipment gets reverted back to whatever it was before. My point is that I don't need it to revert back, because the next time I adventure(x,...) somewhere else, my betweenbattlescript will correctly choose the next outfit I need. I thought that disabling auto-reequip would be a clean way to reduce server hits, but I totally get that this isn't a big deal for anyone else.

Anyway, I feel like a huge idiot for annoying you about this, especially because I've spent the last month coming to appreciate how amazing this program is. I will work around this (I already have an idea) - it really isn't a big deal. Sorry again.
 

Winterbay

Active member
What would happen if the BBS runs a cli_execute("checkpoint clear") at the start? Would the solve the issue?
 
Top