Bug - Fixed Tower Training Familiars with a Counter Checker and Between Battle script

Theraze

Active member
If you are running the built-in mafia code to handle the NS Tower checks and need to train your familiar to reach 20 pounds, if a counter reaches adventure point (for example, Semi-rare counter reaches 0) and either it or a BB script changes your familiar, when the adventure finishes, the tower code will try to train your (changed) familiar to whatever weight the original familiar was supposed to be. So instead of aiming for a level 20 levitating potato, I'm trying to train my level 25 animated macaroni duck to 20, or something similarly failure-esque. Mafia will just keep spending meat/adventures until either I run out, or I abort the training. When I rerun the tower command, it properly switches back to the familiar it should be training.

Would it be possible for tower familiar training to be aware of which familiar it's attempting to train? If it were, and the familiar it wants to train isn't the current familiar, it could just switch back and it wouldn't be a problem. Thanks!
 

Veracity

Developer
Staff member
Let's see if I understand this: you have a user-supplied script which changes the familiar out from under KoLmafia's familiar trainer for an adventure and doesn't bother to change back to the original familiar before handing control back to the familiar trainer? That sounds like a bug in the user-supplied script to me, rather than a "bug" in KoLmafia, as you have characterized it. And you want special code in KoLmafia to recheck the familiar it is training before every arena contest, just in case a buggy script has switched out the familiar on it?

Wow.
 

Theraze

Active member
Yes, it is caused by user scripts, but it's not like automating semirares is especially rare and if you're trying to do tour guide runs and using a BB script to try to assist you in it, this does come up. And you wouldn't want the script to change familiar on every adventure... I could do that, but it would involve an extra ~200 server hits per character, per day, if I don't remember to change the familiar to the current tour, or training happens on a non-tour familiar, since I generally let the script handle the familiar. For that matter, when it gets time for fighting the NS, I usually switch familiar back by having the gCLI run an adventure someone safe, like the treasury, fantasy airship, or giant's castle...

If it doesn't get fixed, not a major issue, I can just keep my eye out and manually cancel when it tries to train the wrong familiar. It's what I've been doing. I just thought that posting the problem here rather than referring to it later in a script thread as one of those fun quirks mafia has would be more appreciated by the developers. :)
 

Veracity

Developer
Staff member
If it doesn't get fixed, not a major issue, I can just keep my eye out and manually cancel when it tries to train the wrong familiar. It's what I've been doing. I just thought that posting the problem here rather than referring to it later in a script thread as one of those fun quirks mafia has would be more appreciated by the developers. :)
"Fun quirks" in KoLmafia, as opposed to "fun quirks in the set of scripts that Theraze chooses to run". Sheesh.

YOUR SCRIPT is, apparently, force-changing a familiar, whenever a between-battle script would run. That doesn't happen in familiar training - except when YOUR SCRIPT decides to farm a semi-rare. When you are in the tower. Why do you give a damn about farming a semirare when you are so close to the NS?

Additionally, you are asking KoLmafia to automate training your tower familiars for you, rather than making your own decisions about how to get them up to the desired 20 lbs. You're in Bad Moon? Doing tour guide runs? Wow. That's about the ONLY time I can imagine NEEDING to arena-train a tower familiar. A single +5 familiar weight skill + 1 semirare + a dispensary item obviates the arena for tower familiars. With no skills, you could, oh, just use all 5 of the tower familiars in-run for 25 (or 13) combats each to train them up to 5 lb. Simple, lazy, and works fine - except for your 100% runs.

So, you are choosing to do no-skill tour guide runs, choosing to run a counter script which force changes your familiar, choosing to let KoLmafia automate the tower familiars for you - and you want me to add code to the familiar trainer to cater to that set of decisions, rather than YOU change anything in what you CHOOSE to do. It's not difficult code, I expect, and it's something that could happen with anybody running a counter script (a feature added LONG after the familiar trainer was built) which chooses to swap familiars, but sheesh.
 

Theraze

Active member
Yeah... part of the issue is that the BB scripts only run before, not after battles. So while I can put in a check for the location and tell it to change back if the prior location was the training (does that even actually count as a location?), it won't switch back through the before battle script... But yeah, I can try to make the scripts work around it, if that's your preferred style. That only fixes my scripts though. Anyone else as crazy as me in the future would still be confused. Though I'm not sure if there's any real solution for that... :)
 

Veracity

Developer
Staff member
Why don't you look at swingui/FamiliarTrainingFrame.java and find the loop where it repeatedly enters a contest. Figure out how to make it check the current familiar against what it expects, and switch it in if it is incorrect. As I said, it should be simple - but I don't have time.

You come up with a patch, and I'll look more favorably on this. ;)
 

Theraze

Active member
Okay, this should now leave the validating that you want the training to continue, that it can still continue, and that you have enough meat. After that, it checks if you have the familiar it expects equipped. If not, it should change back to it.

I used the comment/code from session/SorceressLairManager where it checks to see if the currently equipped familiar is the right one, and summons the one set by the function initially if it isn't right.
 

Attachments

  • SwitchTrainingFamiliar.patch
    615 bytes · Views: 32
Top