Character Info Toolbox

Here are a few things I noticed:

1) the familiar dropMatcher thing with trying one regex and if that fails trying another seems wasteful; I have the following regex there and it seems to work:
Code:
 matcher dropMatcher = create_matcher("<b\>Familiar:</b\>\s*(\?:<br\>)?\s*\\((.*?)\\)</font\>", source);
Note the \s* for any amount of whitespace and (\?: ) for a non-capturing group

2) the following switch ( myfam ) doesn't seem to have an option for blavious kloop (that should be info = "Folio: " + info

3) the script doesn't seem observe familiar weight cap (makes difference for hatrack and pantsrack); I have this at the end of the famWeight block:
Code:
        int fwcap = numeric_modifier("Familiar Weight Cap");
          if (fwcap > 0 && fwcap < to_int(famweight)) {
                  famweight = to_string(fwcap);
          }
          famweight = famweight + " (" + to_string((familiar_weight(my_effective_familiar()))) + ")";
 
1 and 2 are now in my code. Thank you. With respect to 3... It seems that it would require a good bit more work to make it good. (And I'm unsure why the proper weight cannot be read from the character sheet including cap.) In the following code...


Code:
	matcher weightMatcher = create_matcher("</a\></b\>, the <b\>(.*?)</b\> pound ", source);
	matcher feastMatcher = create_matcher("the <i\>extremely</i\> well-fed", source);

	//Is the familiar Well Fed?
	if (find(feastMatcher)) {
		weightMatcher = create_matcher("</a\></b\>, the <i\>extremely</i\> well-fed <b\>(.*?)</b\> pound ", source);
		isFed = true;
	}
	
	//Get Familiar Weight
	if (find(weightMatcher)) {
		famweight = group(weightMatcher, 1);
	} else if (myfam != $familiar[none]) {
		famweight = to_string(familiar_weight(myfam) + weight_adjustment());
	}

Note that two different matchers are used, then based on the second matcher, the first is altered... It would be nicer to have a single matcher and set isFed if "<i\>extremely</i\> well-fed" is present in a capturing group. Could you take that on?

I appreciate all collaborators who want to improve this script and I'm happy to include your work. Thank you!
 
1 and 2 are now in my code. Thank you. With respect to 3... It seems that it would require a good bit more work to make it good. (And I'm unsure why the proper weight cannot be read from the character sheet including cap.)
I don't know, for some reason I had problems with it ... so I added a failsafe to never show a weight greater than the maximum possible ... and as a "bonus" started showing naked/unbuffed weight too.
It's possible that the matcher simply doesn't match at all? Lately, I have seen several scripts (not ASH - greasemonkey, but still), where the authors were apparently getting different HTML than I am getting ..

In the following code...


Code:
	matcher weightMatcher = create_matcher("</a\></b\>, the <b\>(.*?)</b\> pound ", source);
	matcher feastMatcher = create_matcher("the <i\>extremely</i\> well-fed", source);

	//Is the familiar Well Fed?
	if (find(feastMatcher)) {
		weightMatcher = create_matcher("</a\></b\>, the <i\>extremely</i\> well-fed <b\>(.*?)</b\> pound ", source);
		isFed = true;
	}
	
	//Get Familiar Weight
	if (find(weightMatcher)) {
		famweight = group(weightMatcher, 1);
	} else if (myfam != $familiar[none]) {
		famweight = to_string(familiar_weight(myfam) + weight_adjustment());
	}

Note that two different matchers are used, then based on the second matcher, the first is altered... It would be nicer to have a single matcher and set isFed if "<i\>extremely</i\> well-fed" is present in a capturing group. Could you take that on?

I think you want something like
Code:
matcher weightMatcher = create_matcher("</a\></b\>, the (<i\>extremely</i\> well-fed )?<b\>(.*?)</b\> pound ", source);
and then check if group(weightMatcher,1) is "" for non-well-fed, and group(weightMatcher,2) for current weight.


umm ... why are the ">" escaped but not the "<", again?
 
It turns out that the matcher never really worked properly for an unfed familiar due to a white space issue. And there was no reason at all to escape those angle brackets. Thanks for your help. I've fixed it and it works now:

Code:
	//Get Familiar Weight
	matcher weightMatcher = create_matcher("</a></b>, the (<i>extremely</i> well-fed)? <b>(.*?)</b> pound ", source);
	if (find(weightMatcher)) {
		isFed = weightMatcher.group(1) != "";
		famweight = weightMatcher.group(2);
	} else if (myfam != $familiar[none]) {
		famweight = to_string(familiar_weight(myfam) + weight_adjustment());
	}

Updated to 0.6.2.5
  • Several fixes for familiars
 
Last edited:
Updated to 0.6.3
  • Shortened some messages
  • Made Clancy's image smaller. (He's now 80% size since any smaller made him ugly.)
  • Added the new Hidden Temple semi-rare to the semi-rare advisor
  • Use zversions for update checking
  • Code tidying

I think I'm pretty happy with this script now.
 
Last edited:
I've been doing my Bad Moon loop and have noticed the charpane doesn't work until I get a terrarium.

That's interesting, but since I'm not doing Bad Moon these days I can only fix it if you were to post the html from your character pane before you get a terrarium. Please show it to me so that I can fix it.
 
pwdhash is not sensitive data. It ceases to be relevant when you log out since KoL generates a new one for you every time you log in.

hesuchia, I've noticed that for the last few weeks charpane relay scripts will cease to change text after autostop adventures. I think that is a KoL bug, but it is infrequent enough that I haven't been bothered to write it up. That's what you're seeing. If there is no error message in the CLI about something like "CHIT: Compact Character Pane not supported" then it probably wasn't chit's error.

As a result, the html you attached to your post is useless to me. Merely refreshing the charpane would fix that problem.
 
hesuchia, I've noticed that for the last few weeks charpane relay scripts will cease to change text after autostop adventures. I think that is a KoL bug, but it is infrequent enough that I haven't been bothered to write it up. That's what you're seeing. If there is no error message in the CLI about something like "CHIT: Compact Character Pane not supported" then it probably wasn't chit's error.

As a result, the html you attached to your post is useless to me. Merely refreshing the charpane would fix that problem.

I've seen the same mafia behavior recently. It's actually a case of mafia going gray for me (I think PENDING_STATE), which requires doing something with mafia and isn't reset by reloading the charpane. I've added some stuff to mafia to try tracking it down before filing a bug report, but I might be out of autostop stuff to test with for a while.
 
I hadn't quite put that together. I'm gonna go make a proper bug report now. Fortunately it isn't hard to get a completely predictable autostop when ascending with Clancy so I started a debug log right before one.
 
It's looking good Bale.

Three minor bugs. When you only have one instrument for Clancy, when clicking on the instrument to change it, it shows this:

Code:
You don't have any equipment for your none.

Poor

You don't have any equipment for your none.

Poor

The fact that it shows it twice is a bug, the fact that is says "for your none" is a bug and the fact that it says Poor without a name is a bug.

Minor stuff, but thought I'd at least report them.
 
Back
Top