TraFa - The familiar helper

Update v1.4

Fixed a bug that was preventing 100% runs from being parsed correctly.
Added a tour guide run count to faminfo().
Added special handling for
Frumious Bandersnatch equipment.

Added support for the stocking mimic. This requires r7965 or later.

boolean [item] candy
boolean feed_stocking
boolean buy_candy

boolean [item] candy is a list of the candy you want the script to consider for use.

If feed_stocking is true any time the script uses your stocking mimic it will try feed it to gain weight. It will only feed it candy that is in the boolean [item] candy list and only if you have it in inventory.

If buy_candy is true and feed_stocking is true and you don't have any of the candy in the candy list in inventory the script will buy the cheapest candy in the candy list and feed your stocking.

 
Last edited:

mredge73

Member
alias efam => ash import <trafa.ash> famequip(to_string(my_familiar()));
Equips your current familiar with it's familiar specific equipment. Obtains it's equipment if you don't already have it.

I tried this alias thinking that it would equip my familiar with it's equipment. I assumed that it would purchase it from the mall rather than waste 10 adv. Is there an alias where your script can be used to just purchase/equip current familiar equipment?
 
The logic the script uses to decide whether to buy the equipment or use the arena is as follows:

Code:
if(to_boolean(get_property("autoSatisfyWithMall")))
   if(mall_price(familiar_equipment(my_familiar())) < winsneeded * (100 + to_int(get_property("valueOfAdventure"))))
      buy(1,familiar_equipment(my_familiar()));
It first considers mall preferences, it then parses arena.php to see how many arena wins are needed to get the equipment, then finally it calculates if the mall price of the equipment is less than the valueOfAdventure plus 100 times the number of wins needed.

The key factor as far as user preference goes is the valueOfAdventure mafia preference. The default for this setting is 500.
To change it type set valueOfAdventure=X into the cli, where X is the value you want to set it to.

If you value your adventures higher the script will be less likely to use the arena and more likely to just buy the equipment from the mall.
 

lostcalpolydude

Developer
Staff member
So it's missing the 25% chance at a lead necklace in that calculation. I believe that's best accounted for by multiplying the right side by 4/3, and actually getting a lead necklace means recalculating to see which method is better.
 
So it's missing the 25% chance at a lead necklace in that calculation.

I didn't know about the 25% chance of getting the lead necklace. Thanks for pointing that out. I don't know how I missed that while I was creating this script. Next update will include it in the calculation.
 

Bazaaretw

Member
I'm not exactly sure how to even work this, I don't need to to train any familiar, but I figured I'd use it to get all my familiar equipments. I put true on all of the ones pertaining to trophy and equipment, because I already have all the trophies for weight. I'm going to post here what I did and what it gave me.

But basically no matter what I tried it only equipped the equipment that I currently owned instead of obtaining all.

Code:
> alias efall => ash import <trafa.ash> getfamequip();

String successfully aliased.
efall => ash import  getfamequip()

Code:
> efall => ash import <trafa.ash> getfamequip();

Expected ;, found = ()
Returned: void

Code:
> ash import <trafa.ash> getfamequip();

Checking familiars equipment...
Putting Toothsome Rock the Toothsome Rock back into terrarium...
Taking Gronald the Stocking Mimic out of terrarium...
moveable feast is better than (none). Switching items...
Putting on moveable feast...
Equipment changed.

Visit to Town: Sleazy Back Alley in progress...

[1063] Sleazy Back Alley
Encounter: completely different spider
Strategy: C:\Documents and Settings\Compaq_Owner.YOUR-D0F670B45A\Desktop\KOL Mafia\ccs\default.ccs [default]
Round 0: bazaaretw wins initiative!
Round 0: bazaaretw attacks!
You gain 7 Meat
You acquire an item: spider web
You gain 3 Muscleboundness
You gain 2 Wizardliness
You gain 4 Smarm

Returned: void

All familiars are equipped & ready to go!
After this I checked and I had the bag of candy for the stocking although I never saw it actually get one.

Code:
> efall

Checking familiars equipment...

Visit to Town: Sleazy Back Alley in progress...

[1064] Sleazy Back Alley
Encounter: hung-over half-orc hobo
Strategy: C:\Documents and Settings\Compaq_Owner.YOUR-D0F670B45A\Desktop\KOL Mafia\ccs\default.ccs [default]
Round 0: bazaaretw wins initiative!
Round 0: bazaaretw attacks!
You acquire an item: Mad Train wine
You acquire an item: dirty hobo gloves
You gain 3 Strongness
You gain 2 Magicalness
You gain 4 Roguishness

All familiars are equipped & ready to go!

Returned: void

What am I doing wrong? I also just ran the script, and it wouldn't obtain but rather just equip what I currently had.


Also this script takes amazingly long to work, I'm not sure if it's just because of the amount of familiars I have that it has to check, but it takes nearly 5 min before it does anything.

Just an update: I just ran the script again.
Code:
> call scripts\trafa.ash

Populating collected familiars list...

Checking familiars equipment...
All familiars are equipped & ready to go!

And that took 4 minutes. I'm not even sure if there is a way to make it calculate quicker, but just letting ya know :D
 
Last edited:
@ Bazaaretw
Code:
> alias efall => ash import <trafa.ash> getfamequip();

String successfully aliased.
efall => ash import  getfamequip()
Code:
> efall

Checking for updates (running ZLib ver. : 14)...
_version_zlib => : 14
You have a current version of ZLib.
Checking for updates (running TraFa ver. 1.4)...
_version_trafa => 1.4
You have a current version of TraFa.
Checking familiars equipment...
Searching for "eye-pod"...
Starting training session...
Taking off lead necklace...
Equipment changed.
Round 1: Gorg vs. Ol' Gned...

[33281] Cake-Shaped Arena
Gorg gains 5 experience.
Putting on lead necklace...
Equipment changed.
Training session completed.
Starting training session...
Taking off lead necklace...
Equipment changed.
Round 1: Gorg vs. Ol' Gned...

[33282] Cake-Shaped Arena
Gorg gains 4 experience.
Putting on lead necklace...
Equipment changed.
Training session completed.
Starting training session...
Taking off lead necklace...
Equipment changed.
Round 1: Gorg vs. Ol' Gned...

[33283] Cake-Shaped Arena
Gorg gains 5 experience.
Putting on lead necklace...
Equipment changed.
Training session completed.
Starting training session...
Taking off lead necklace...
Equipment changed.
Round 1: Gorg vs. Ol' Gned...

[33284] Cake-Shaped Arena
You acquire an item: eye-pod
Gorg gains 5 experience.
You win a prize: eye-pod.
Putting on lead necklace...
Equipment changed.
Putting on eye-pod...
Equipment changed.
Training session completed.
Baby Gravy Fairy equipment obtained!

Putting Gorg the Baby Gravy Fairy back into terrarium...
Taking Grorg the Star Starfish out of terrarium...
lead necklace is better than (none). Switching items...
Putting on lead necklace...
Equipment changed.
Searching for "magnifying glass"...
Using cached search results for magnifying glass...
Purchasing magnifying glass (1 @ 150)...
You acquire an item: magnifying glass
Purchases complete.
Putting on magnifying glass...
Equipment changed.
Star Starfish equipment obtained!

All familiars are equipped & ready to go!

Returned: void
I had two familiars out of 43 that were missing their equipment the first one it used the arena and the second one it just bought the equipment since it was significantly cheaper that way. All of that happened in under 30 seconds! (I'm running it on a computer with a 333 MH processor so it's not particularly a fast computer.) I'm not sure why it's taking so long for you.

You did clue me in on a bug with the Stocking Mimic were it gets the equipment, but doesn't actually equip it. Another fix for the next update.
 

Bazaaretw

Member
My computer is pretty sub par, over 6 years old cheap computer. I have about 90 familiars.

I don't have an issue with the speed tho, it was that I couldn't get it to work properly :\ I'll try it out again today.
 
Update v1.5

Update v1.5

  • Re-factored code. Less duplication and runs quite a bit faster.
  • Changed prints to vprints.
  • Changed aborts to exits.
  • Improved the calculation for familiar equipment obtaining to account for the chance of getting a lead necklace.
  • Fixed Bandersnatch equipment obtaining logic.
  • Added a tune Bandersnatch function tune(string to_tune)
alias tune => ashq import <trafa.ash> tune("%%");
That will tune your Bandersnatch to the stat passed.
Valid arguments are: mox, moxie, mus, muscle, myst, & mysticality.
  • Combined the familiartotrain and triansingle variables into a single fuzzy matching string variable famtotrian.
  • Changed how finfo() displays familiar info. It's cleaner now, and easier on the eyes.
  • Added finfo("missing") to display a list of familiars you haven't collected yet.
alias fmiss => ashq import <trafa.ash> faminfo("missing");
  • Added a drunkenness check.
  • Added special handling for familiars with no specific familiar equipment and familiars who are arena handicapped.
  • Familiars who are arena handicapped are no longer considered when trophy training in the arena.
  • Added special handling for the Purse Rat, Dancing Frog, Baby Bugged Bugbear, Crimbo P.R.E.S.S.I.E.
  • Added special handling for elemental gravy fairies.
  • Updated aliases in second post of this thread. WARNING: If you were using any of these aliases they probably will not work correctly with the re-factored code. Please update any aliases. See the second post in this thread for examples.
 

slyz

Developer
I just tried the Bander tuning alias, and the crimsilion jub-jub bird that was equipped on it wasn't recognized.
Line 123 should be:
PHP:
if(familiar_equipped_equipment(famtocheck) == itm || item_amount(itm) > 0)

edit: great addition, Mafia was lacking in the regard.
 

jwylot

Member
You have 75 familiars whose combined weight is 510
You're total terrarium weight is already 500 pounds or more!! No weight training necessary.
The current familiar weight trophy goal is 0
Buying trophy #17 at the Trophy Hut
You bought a new trophy! The Black Hole Terrarium trophy.
Familiar weight trophy training ended.
Total terrarium weight is 510. Your terrarium grew 0 lbs this training session.

My terrarium includes a 27 lb stocking which doesn't count for the 500 lb trophy though. Does this require a fix?
 
Update 1.6

  • Re-factored code
  • Added special handling for the Mini-Hipster.
  • Fixed a bug that was preventing arena-handicapped familiars from being trained properly. In decided whether to use the arena to get an arena-handicapped familiars equipment or to just buy it, the cost of getting it in the arena is now doubled in order to place more weight on buying the equipment.
  • Stocking Mimic is no longer calculated or trained when trying to get the trophies.
  • Added the feast() function

boolean feast(familiar famtofeed)

Ruturns true if it successfully gorges famtofeed with the Moveable Feast or if famtofeed is already extremely well-fed. Using feast() without passing a familiar attempts to gorge your currently equipped familiar. Each day, after the Moveable Feast has been used five times the script sets the property "_feastDepleted".

You can also utilize the following alias:

PHP:
alias feast => ashq import  <trafa.ash> if(length("%%") != 0)  use_familiar(to_familiar(substring("%%",0,length("%%")-1))); feast();
Gorges a specified familiar with the Moveable Feast. Uses mafia's fuzzy matching. For example, you could type "feast lep" or "feast star" sans quotes to gorge your Leprechaun or Starfish. Passing no familiar attempts to gorge your current familiar.
 
Last edited:

Theraze

Active member
Hmm... is it easy to make the feast alias switch back to your currently equipped familiar? Should it?
 

slyz

Developer
Hmm... is it easy to make the feast alias switch back to your currently equipped familiar? Should it?
Code:
alias feast => ashq import <trafa.ash> familiar f=my_familiar();if(length("%%") != 0) use_familiar(to_familiar(substring("%%",0,length("%%")-1))); feast(); use_familiar(f);
Thanks again That FN Ninja!
 
Last edited:
You're welcome. ;)

I usually use this function on my current familiar. Or as a way to switch familiars and feast at the same time. I see no good reason to switch back to the previous familiar. The buffs get reset at rollover anyway so there really is no reason to gorge a familiar unless you are going to use it.
 

tgetgel

Member
I was looking through this script and it does not seem to use Tiny Fly Glasses or Three Days Slow to increase the familiar experience per battle, nor Curiosity and Empathy to increase the familiars weight. Are these usually not used in training?:confused:
 
Last edited:

slyz

Developer
Thanks a ton for this script, I just used it to get the 500 lbs trophy.

Just a slight mistype: line 667 should read "Your total terrarium weight".
 
Top