Twin Peak automation

VladYvhuce

Member
I fixed it. :cool:

Now it reads:
Code:
if (my_familiar().drops_today >= my_familiar().drops_limit) {
    foreach f in $familiars[fist turkey, adventurous spelunker, machine elf, astral badger, unconscious collective, baby sandworm, rogue program, green pixie, li'l xenomorph] {
        if (have_familiar(f) && f.drops_limit != 0 && f.drops_today < f.drops_limit) {
            use_familiar(f); }
if (my_familiar().drops_today == my_familiar().drops_limit) {
	foreach f in $familiars[intergnat] {
		use_familiar (f); }
		}
    }
}
I'm sure there's a more elegant way to fix the situation, but I'm happy with the way it's working for me so far.
 

Theraze

Active member
At the very least, I'd take out the single-item foreach with no check. Just use_familiar($familiar[intergnat]); instead.
 

VladYvhuce

Member
Cool. That works. I'm not sure what I was doing wrong before, but earlier, I couldn't get Mafia to accept "use_familiar($familiar[familiar name])". It kept telling me that it was an invalid variable... That's why I copied the previous setup with just the Intergnat defined.

Edit: Hmm... Now my script won't stick with a familiar again. And I didn't modify it since that alteration to the Intergnat. It just shuffles through the list (now, without adventuring between switches) until it hits the Xenomorph, and wants to stick with him. And trying to alter the conditions for switching break the script... For now, the modifications to BBB will have to suffice... But I'm still going to be trying to crack this nut in my spare time. At some point, the law of averages will work in my favor...
 
Last edited:

Theraze

Active member
Probably did $familiars[intergnat] rather than $familiar[intergnat]. One is an array, one is a specific familiar.

And depending what you did, that makes sense. Your script as posted will continue to go through familiars until it runs out and switches to the intergnat.
Off the top of my head and without validation:
Code:
familiar dropfam() {
    if (my_familiar().drops_today >= my_familiar().drops_limit) {
        foreach f in $familiars[fist turkey, adventurous spelunker, machine elf, astral badger, unconscious collective, baby sandworm, rogue program, green pixie, li'l xenomorph] {
            if (have_familiar(f) && f.drops_limit != 0 && f.drops_today < f.drops_limit)
                return(f);
        }
        return $familiar[intergnat];
    }
    return my_familiar();
}

main() {
use_familiar(dropfam());
}
 
Last edited:
Top