Vlad's Familiar Changing Frankenscript

VladYvhuce

Member
Looks like you can use enthrone_familiar to do that. You can check your familiars weights, as well as the weight adjustment, to figure out when to shift them, so...
Nope. enthrone only works with a crown of thrones, not a bjorn.

Edit: bjornify_familiar and my_bjorned_familiar work. But I still can't get the weight checking to work with the nice, neat listing function that my "change when the familiar reaches its drop limit" scripts use. I've had to go back to my archaic original design to get the script to work.
 
Last edited:

VladYvhuce

Member
Sorry... I was assuming that people were keeping up with the script work. I can get a bit scatter-brained when I'm frustrated.

This is the code that works:
Code:
void main ()
//Familiars.
	if (my_familiar() != $familiar[astral badger] && (familiar_weight($familiar[astral badger]) < 20)) 
		use_familiar($familiar[astral badger]);
	if (my_familiar() == $familiar[astral badger] && (familiar_weight($familiar[astral badger]) >= 20)) 
		use_familiar($familiar[fist turkey]);
	if (my_familiar() == $familiar[fist turkey] && (familiar_weight($familiar[fist turkey]) < 20)) 
		use_familiar($familiar[fist turkey]);
	if (my_familiar() == $familiar[fist turkey] && (familiar_weight($familiar[fist turkey]) >= 20)) 
		use_familiar($familiar[space jellyfish]);
	if (my_familiar() == $familiar[space jellyfish] && (familiar_weight($familiar[space jellyfish]) < 20)) 
		use_familiar($familiar[space jellyfish]);
	if (my_familiar() == $familiar[space jellyfish] && (familiar_weight($familiar[space jellyfish]) >= 20)) 
		use_familiar($familiar[restless cow skull]);
	if (my_familiar() == $familiar[restless cow skull] && (familiar_weight($familiar[restless cow skull]) < 20)) 
		use_familiar($familiar[restless cow skull]);
	if (my_familiar() == $familiar[restless cow skull] && (familiar_weight($familiar[restless cow skull]) >= 20)) 
		use_familiar($familiar[baby sandworm]);
	if (my_familiar() == $familiar[baby sandworm] && (familiar_weight($familiar[baby sandworm]) < 20)) 
		use_familiar($familiar[baby sandworm]);
	if (my_familiar() == $familiar[baby sandworm] && (familiar_weight($familiar[baby sandworm]) >= 20)) 
		use_familiar($familiar[intergnat]);
		
//Bjorned Familiars
	if (my_bjorned_familiar() != $familiar[galloping grill] && (familiar_weight($familiar[galloping grill]) < 20)) 
		bjornify_familiar($familiar[galloping grill]);
	if (my_bjorned_familiar() == $familiar[galloping grill] && (familiar_weight($familiar[galloping grill]) >= 20)) 
		bjornify_familiar($familiar[li'l xenomorph]);
	if (my_bjorned_familiar() == $familiar[li'l xenomorph] && (familiar_weight($familiar[li'l xenomorph]) < 20)) 
		bjornify_familiar($familiar[machine elf]);
	if (my_bjorned_familiar() == $familiar[machine elf] && (familiar_weight($familiar[machine elf]) >= 20)) 
		bjornify_familiar($familiar[golden monkey]);
	if (my_bjorned_familiar() == $familiar[golden monkey] && (familiar_weight($familiar[golden monkey]) < 20)) 
		bjornify_familiar($familiar[bloovian groose]);
	if (my_bjorned_familiar() == $familiar[bloovian groose] && (familiar_weight($familiar[bloovian groose]) >= 20)) 
		bjornify_familiar($familiar[blavious kloop]);
	if (my_bjorned_familiar() == $familiar[blavious kloop] && (familiar_weight($familiar[blavious kloop]) < 20)) 
		bjornify_familiar($familiar[green pixie]);

This is my working "item drop switch" code, which I can't figure out how to modify to get it to switch with weight:
Code:
cli_execute("checkpoint clear");

familiar next_familiar() {
	foreach f in $familiars[fist turkey, adventurous spelunker, machine elf, astral badger, baby sandworm, rogue program, green pixie, li'l xenomorph, llama lama, blavious kloop]
		if (have_familiar(f) && f.drops_today < f.drops_limit)
			return f;
	if (have_familiar($familiar[intergnat])) return $familiar[intergnat];
	return my_familiar();
}

void main() {
	familiar next = next_familiar();
	if (next != my_familiar()) use_familiar(next);
}
 

Theraze

Active member
That is a TON of wasted server hits. Wouldn't it be easier to do something like:
Code:
boolean setfam = false;
foreach f in $familars[astral badger, fist turkey, space jellyfish, restless cow skull, baby sandworm]
{
if (have_familiar(f) && familiar_weight(f) < 20)
{
if (my_familiar() != f) use_familiar(f);
setfam = true;
}
}
if (!setfam && have_familiar($familiar[intergnat] && my_familiar() != $familiar[intergnat]) use_familiar($familiar[intergnat]);
 

VladYvhuce

Member
That is a TON of wasted server hits. Wouldn't it be easier to do something like:
Code:
boolean setfam = false;
foreach f in $familars[astral badger, fist turkey, space jellyfish, restless cow skull, baby sandworm]
{
if (have_familiar(f) && familiar_weight(f) < 20)
{
if (my_familiar() != f) use_familiar(f);
setfam = true;
}
}
if (!setfam && have_familiar($familiar[intergnat] && my_familiar() != $familiar[intergnat]) use_familiar($familiar[intergnat]);
If that'll get the job done, then I'll be quite happy. I wasn't aware that "setfam" was a thing. I'll overhaul one of my "item drop" scripts and see how it works, tonight.
 

Bale

Minion
setfam isn't a thing. It's just a boolean variable. Anyway, I think that Theraze meant this. (My addition in red.)

Code:
boolean setfam = false;
foreach f in $familars[astral badger, fist turkey, space jellyfish, restless cow skull, baby sandworm]
{
   if ([COLOR="#FF0000"]!setfam && [/COLOR]have_familiar(f) && familiar_weight(f) < 20)
   {
      if (my_familiar() != f)
         use_familiar(f);
      setfam = true;
   }
}
if (!setfam && have_familiar($familiar[intergnat] && my_familiar() != $familiar[intergnat])
   use_familiar($familiar[intergnat]);
 

Theraze

Active member
Right. I forgot the break; when I did that freehand on the forum, which is how I'd have done it to skip some cycles. :) Should have done the write-up in npp instead. Oh well. :)
 

VladYvhuce

Member
Finally! A working script that will change both regular familiar and bjornified familiar! Many thanks for the help, y'all.

Behold!
Code:
//Fam
boolean setfam = false;
foreach f in $familiars[astral badger, fist turkey, space jellyfish, restless cow skull, baby sandworm, rogue program, robortender, bark scorpion, el vibrato megadrone]
{
if (!setfam && have_familiar(f) && familiar_weight(f) < 20)
{
if (my_familiar() != f) use_familiar(f);
setfam = true;
}
}
if (!setfam && have_familiar($familiar[robot reindeer]) && my_familiar() != $familiar[robot reindeer]) use_familiar($familiar[robot reindeer]);

//Bjorn
boolean setbjorn = false;
foreach f in $familiars[unconscious collective, golden monkey, grim brother, bloovian groose, baby mutant rattlesnake, blavious kloop, galloping grill, rockin' robin, optimistic candle]
{
if (!setbjorn && have_familiar(f) && familiar_weight(f) < 20)
{
if (my_bjorned_familiar() != f) bjornify_familiar(f);
setbjorn = true;
}
}
if (!setbjorn && have_familiar($familiar[piano cat]) && my_bjorned_familiar() != $familiar[piano cat]) bjornify_familiar($familiar[piano cat]);
 

Pazleysox

Member
Finally! A working script that will change both regular familiar and bjornified familiar! Many thanks for the help, y'all.

Is there an SVN, or a file we can download? I would like to try this, but I'm not exactly sure which part of the code I'm supposed to use. :confused:
 

VladYvhuce

Member
Is there an SVN, or a file we can download? I would like to try this, but I'm not exactly sure which part of the code I'm supposed to use. :confused:
Oh, wow. I didn't expect anyone would care about my tinkering with other people's script to get them to do my bidding... These scripts work best if used as pre-adventure scripts. You'll want to customize them to fit with your own familiars.

"famchanger" is the one what will change the familiars based on weight. I've added a section so that now it covers familiar, bjorned familiar, and enthroned familiar. If you lack a bjorn and/or a crown of thrones, then comment out or delete the part you don't need. It assumes you have both a bjorn and a crown equipped.

"DropFams" is the one what changes familiars once they reach their daily item drop limits, and then switches to one without drop limits, if you have adventures to spare after farming. It's a lot simpler than "famchanger".

View attachment DropFams4-6.ashView attachment famchanger1-1.ash
 

Theraze

Active member
FYI, if you're posting for your own interest and not meaning it to be released, Scripting Discussion would be the place for those questions. The Repository is where you keep scripts that you want people to use. :)
 

VladYvhuce

Member
FYI, if you're posting for your own interest and not meaning it to be released, Scripting Discussion would be the place for those questions. The Repository is where you keep scripts that you want people to use. :)
This is the right place. I'm just surprised that someone actually cared about them, is all. ;)

VladYvhuce, would you like me to move the thread from the Repository to Discussion?
No thanks. I think they're in the right place.
 

Pazleysox

Member
Not sure if this is a bug or not, but...

I used part of Vlad's script on a script that I'm using. It's designed to look for things that can still be done.

I added all familiars that have item drops.

"Miniature Sword & Martini Guy" isn't recognized by mafia.

I get the error: Bad familiar value: Miniature Sword & Martini Guy
but if I remove the "Martini Guy", Mafia says to use "Miniature Sword & Martini Guy", and continues on with the script anyways
 

Theraze

Active member
Probably needs & or something similar, but... try it in gCLI? Just running ash $familiar[miniature sword & martini guy] should show if that's right or if you need to keep looking for the right value on that name...
 

Theraze

Active member
Yep, your only current option is combining the & with to_familiar, like so:
to_familiar("Miniature Sword & Martini Guy")
 
Top