Looking for familiar_experience()

Fluxxdog

Active member
Maybe I'm missing something, but I can't seem to find any kind of function the returns a familiar's current experience. Something along the lines of:
int familiar_experience(familiar buddy)
...which returns either the familiar's current experience, or in the case of the Stocking Mimic how many candies he's had. Is there such a function? If not, how would I code it?
 
This function doesn't exist, so you'd probably have to use visit_url() with the page for the terrarium, then parse that.
 
I suppose a better way to ask this question would be "How does mafia track familiar experience?" .Here's the code I have now:
PHP:
void stuff_stocking(string yummies){
if(possess_item(yummies)){
	print("Feeding your mimic "+yummies+"...");
	visit_url("familiarbinger.php?action=binge&qty="+have_item(yummies)+"&whichitem="+to_int(to_item(yummies))+"&pwd");}
return;}

void mimic_stuffer(){
if(familiar_weight($familiar[stocking mimic]) < 100){
	string [int] candy_list; int candycount = 0;
	file_to_map("candyman.txt" , candy_list);
	for i from 1 to (count(candy_list)) candycount = candycount + have_item(i);
	if(candycount >= ((familiar_weight($familiar[stocking mimic]))^2 - (familiar_weight($familiar[stocking mimic])-1)^2)/2){
		for i from 1 to (count(candy_list)) stuff_stocking(candy_list[i]);}
	if(able_to_change($item[bag of many confections])) equip($item[bag of many confections]);
	else equip($slot[familiar],$item[none]);}
if(able_to_change($item[ittah bittah hookah]) && familiar_weight($familiar[stocking mimic]) == 100)
	equip($item[ittah bittah hookah]);}
However, I notice that mafia displays how much experience familiars need to get to their next pound even for the Stocking Mimic. I'm trying to keep from hitting the server after each battle just to feed my mimic. Right now, I have guess work in place, but I'd like something a bit more exact. Or does mafia hit the server each time itself? All I want to do is access that information.
 
However, I notice that mafia displays how much experience familiars need to get to their next pound even for the Stocking Mimic.

What? How does mafia display that? Are you referring to KoL's interface option to enable a familiar progress bar?
 
Exactly. It has to get the data from somewhere, likely when it scans familiars at login. I'd just like to know how to access that info. 10 to one says this is going to end up being a feature request.
 
Now I gotta double check because I don't remember seeing it before mafia...
..<runs off to check>...
...SOB, you're right. Crud. Now I'm really at a loss. I found to code for the familiar display in the charpane frame source for it:
Code:
<font size=2>Tofflesby</a></b>, the  <b>6</b> pound Baby Gravy Fairy<table title='0 / 4' cellpadding=0 cellspacing=0 style='border: 1px solid #5A5A5A'><tr><td height=3 width=0 bgcolor=#5A5A5A></td><td width=100 bgcolor=white></td></tr></table></font></td></tr></table></center><center><p><b><font size=2><br />
...I'm not sure how to parse it though and extract the information. The "<table title=" part is also present in the level and stat progress. I know how to build contains_text() searches, but I'm pretty sure that wouldn't work here. What functions would I be using? And would I need to reload charpane.php after each fight?
 
PHP:
buffer r;
r.append(visit_url("charpane.php"));
r.delete(0,r.index_of("</b> pound"));

Although, okay, this won't work with the compact charpane. You'd probably have to load it after each fight, though. (Theoretically a relay override would work to set a preference, except some issues have come up with relay overrides and charpane.php...)
 
Thanks heex3. That was the nudge I needed. Ended up with this little diddy:
PHP:
buffer r = visit_url("charpane.php");
r.delete(0,r.index_of("</b> pound"));
r.delete(0,r.index_of("'")+1);
r.delete(r.index_of(" "),length(r));
int fam_exp=(to_int(to_string(r)));
int fam_exp_to_level=( ((familiar_weight(my_familiar())+1)^2) - (familiar_weight(my_familiar())^2) - fam_exp);
print(fam_exp_to_level);
This will display how much familiar experience you need for your familiar's next pound. This will cause charpane.php to be loaded each time, but that's quite a smaller size than familiar.php and I won't be hitting the server to feed my mimic until I actually have enough to give him a pound.

Fun fact: buffers seem to act like strings except for to_int() which will always return 0. Convert a buffer to a string and Voila!

Thanks again for your help, guys. Much appreciated.
 
Heh, thanks for point this out. I updated this quite some time ago using zLib:
Code:
int fam_exp_to_next_level(){
int fam_exp=to_int(excise(visit_url("charpane.php"),my_familiar()+"<table title='"," / "));
return( ((familiar_weight(my_familiar())+1)**2) - (familiar_weight(my_familiar())**2) - fam_exp );}
It still only seems to have use for calculating Stocking Mimic experience though in order to see if it'll need candies. Still feel a bit guilty about having to hit the server each time while he's less than 100 pounds.
 
Last edited:
So... new one does same as the prior one, just doesn't need to display the string, right? So... this should make it into an alias?
alias familiartonext => ashq import <zlib.ash> int fam_exp=to_int(excise(visit_url("charpane.php"),my_familiar()+"<table title='"," / ")); print( ((familiar_weight(my_familiar())+1)**2) - (familiar_weight(my_familiar())**2) - fam_exp );
 
Eh, I don't quite go for the alias since I use this in a script to calculate how many candies a mimic need to gain weight. You should see it when I hit aftercore and get all my gear from Hagnk's. "Yeah, so, we're gonna add about 30 pounds to your mimic using all the candy you had left over from your last run...." And keep in mind my mimic is usually about 35 pounds naturally by this time ^^
 
Back
Top