Familiar Optimizer 1.0
I have been lurking on this forum for quite some time now and I thought I could give a little back for all the wonderful scripts that I use every day. I have Familiar Optimizer set up in my mood and it has become invaluable. Any feedback on the code is more than welcome.
This script checks your HP and MP levels, if your levels are at or below your low threshold Familiar Optimizer will change to a HP and MP producing familiar, switching back to your previous familiar once you get at or above your high threshold. This works best with zarqon's excellent SmartStasis script.
To use the script place fo_familiars.txt in you data directory. Place familiar-optimizer.ash in you scripts directory. You will also need zargon's zlib. Set familiar-optimizer.ash as an unconditional trigger in your mood settings to run it after each adventure, or if you prefer to have the script run before an adventure set it as a bewtween battle script.
set betweenBattleScript=familiar-optimizer.ash
This script does not take into account familiar equipment or weight.
Changing familiars during the recovery process will result in that familiar being switch out when your HP/MP levels rise above your threshold.
The map file is a tab delimited list of familiars in order of preference.
Feel free to edit it to your own preferences.
Properties are saved in <character-name>_prefs.txt so you can use different settings for each character. Right now the only way to change your HP/MP threshold is by editing your <character-name>_prefs.txt or using the set_property command for example enter into gCLI:
ash set_property("fo_hp_fpercent",.25);
ash set_property("fo_hp_cpercent",.90);
ash set_property("fo_mp_fpercent",.25);
ash set_property("fo_mp_cpercent",.90);
Known bugs:
For some reason KoLmafia tries to equip a new familiar with the current familiar's equipment even if it won't work i.e. trying to equip a Meat detector on a Cocoabo
I don't use familiar items for my main character because of Hardcore, so this is relatively untested
Change Log
6/3/09 Version 0.1
Original concept layed out and tested.
6/4/09 Version 0.2
Added ceiling percent
Added debug function
Code cleaned up and commented
6/4/09 Version 0.3
Added fo_first_run to initialize defaults
Fixed bug that would cause recovery to stop if MP and HP were below threshold and one of them was fully recovered.
Fixed bug that caused an Ancient Yuletide Troll to be equipped after first run.
8/2/09 Version 1.0
Added version checking from zlib
Public release
I have been lurking on this forum for quite some time now and I thought I could give a little back for all the wonderful scripts that I use every day. I have Familiar Optimizer set up in my mood and it has become invaluable. Any feedback on the code is more than welcome.
This script checks your HP and MP levels, if your levels are at or below your low threshold Familiar Optimizer will change to a HP and MP producing familiar, switching back to your previous familiar once you get at or above your high threshold. This works best with zarqon's excellent SmartStasis script.
To use the script place fo_familiars.txt in you data directory. Place familiar-optimizer.ash in you scripts directory. You will also need zargon's zlib. Set familiar-optimizer.ash as an unconditional trigger in your mood settings to run it after each adventure, or if you prefer to have the script run before an adventure set it as a bewtween battle script.
set betweenBattleScript=familiar-optimizer.ash
This script does not take into account familiar equipment or weight.
Changing familiars during the recovery process will result in that familiar being switch out when your HP/MP levels rise above your threshold.
The map file is a tab delimited list of familiars in order of preference.
Feel free to edit it to your own preferences.
Properties are saved in <character-name>_prefs.txt so you can use different settings for each character. Right now the only way to change your HP/MP threshold is by editing your <character-name>_prefs.txt or using the set_property command for example enter into gCLI:
ash set_property("fo_hp_fpercent",.25);
ash set_property("fo_hp_cpercent",.90);
ash set_property("fo_mp_fpercent",.25);
ash set_property("fo_mp_cpercent",.90);
Known bugs:
For some reason KoLmafia tries to equip a new familiar with the current familiar's equipment even if it won't work i.e. trying to equip a Meat detector on a Cocoabo
I don't use familiar items for my main character because of Hardcore, so this is relatively untested
Change Log
6/3/09 Version 0.1
Original concept layed out and tested.
6/4/09 Version 0.2
Added ceiling percent
Added debug function
Code cleaned up and commented
6/4/09 Version 0.3
Added fo_first_run to initialize defaults
Fixed bug that would cause recovery to stop if MP and HP were below threshold and one of them was fully recovered.
Fixed bug that caused an Ancient Yuletide Troll to be equipped after first run.
8/2/09 Version 1.0
Added version checking from zlib
Public release