New Content - Implemented March 2012 IOTM - Happy Medium

Veracity

Developer
Staff member
Well, if it could be a proxy field
Proxy fields are not necessarily actual stored data; they CAN be calculated on the fly as needed. In this case, it would be a function with a switch statement that gets the data from preferences or internal variables, as needed. Well, it's not out of the question, but the precedent is Yet Another Preference.

99% of familiars would have that proxy field as empty. ... The various familiars that use charges though, including the medium, grinder, and stomping boots could all use that charges proxy field.
So three familiars with charges are part of the 1%, meaning we have 300 familiars, eh? ;)
 

roippi

Developer
Heh. The above series of comments summarizes my thoughts pretty well.

I'm not averse to making it a proxy field, but it's awkward to have .charges be meaningless for 99% of familiars.

Likewise, a dedicated ASH function: rather awkward.

Preference: not awkward, but technically unneeded disk I/O. I suppose it's the lesser sin. Plus, if you log in without your medium equipped, you'll still know its state. So that's something.
 

Theraze

Active member
Well, I started my math on the two consumables (and round(to_float(2)/154*100)=1) then the stomping boots came into it and messed it all up. :) Well, 1.29% of familiars on the two... Though even with 3 familiars it's still only 1.94%, so a floor would drop it to 1, but the round brings it up to 2%. :(
 

slyz

Developer
If we are going for a proxy field, scripters could simply check $familiar[ happy medium ].image (we would have to update it when we read charpane.php or api.php though).
 

roippi

Developer
That's.. not terrible, actually, but a bit unsatisfying to ask scripters to parse a number in the middle of a string to get the charges.

$item has a good number of fields that are not applicable to the majority of items. If an item is not a consumable, for example, it has a good number of blank fields. So, there's precedent for having "situationally worthless" fields, though obviously this field would be "worthless" far more often than others.

I don't know, this "feels" like it should be a proxy record to me. Would there be any merit in somehow hiding or not returning the field if not applicable to the data type? I assume that that would break a lot of scripts if suddenly $item[snorkel].quality was not a valid field. Just spitballing, I don't know.
 

Theraze

Active member
We use those fields sometimes to validate whether it's a consumable... it would still work, we would just need to convert what we use. Now, hiding it in the display if it's unset? That shouldn't make anyone feel bad, except that then you can't just check any item/monster/whatever to see all of the possible proxy records...
 

Fluxxdog

Active member
That's.. not terrible, actually, but a bit unsatisfying to ask scripters to parse a number in the middle of a string to get the charges.
Code:
string medium_aura(){
switch($familiar[Happy Medium].image){
case "medium_1.gif": return "blue";
case "medium_2.gif": return "orange";
case "medium_3.gif": return "red";}
return "none";}

if(medium_aura()=="red") page=visit_url("fight.php?action=macro&macrotext=skill Siphon Spirits;bludgeon to death;repeat");
Give us the info and we can work out the rest ^^
 

roippi

Developer
Heh, I'd actually forgotten that you can switch on strings in ASH.

KoL saw fit today to give me a 30 turn temple, 40 turn oasis, and 3 clover'd baskets that do not contain a black pepper, so I'll break prism tomorrow and implement the proxy record.
 

Veracity

Developer
Staff member
I'll break prism tomorrow and implement the proxy record.
There already is a familiar.image. I assume you mean "update the Happy Medium's image according to whatever it was last time we saw her in the char pane"?
 

StDoodle

Minion
How about an ash function int familiar_charges(familiar) that could be applied to all applicable familiars? I doubt this is the last one we'll see that will have such a feature.
 
Last edited:

roippi

Developer
And here's a fun KoL bug that cost me 20 minutes worth of time: api.php's "familiarpic" field is always "medium_0" regardless of which one it is in reality on the actual charpane. Graah. Reporting it.
 

roippi

Developer
r10728 adds _mediumSiphons and the .charges proxy field. I left the api.php parsing commented out, since that's worthless right now.

Annoyingly, the api.php bug causes the image displayed on the green sidepane to be incorrect every time we hit api.php?what=status with a charged medium. It fixes itself when we subsequently see the charpane. This has nothing to do with this commit, just making people aware of it.

TODO: charpane decoration
 

Fluxxdog

Active member
New $familiar proxy record: .charges. The only familiar that uses this right now is the Happy Medium, but the stomping boots and grinder can eventually utilize it.
For reference sake, with the Organ Grinder, what would it be counting exactly, the number of pie parts he's collected?

Also, another familiar that could use this is the Jack-in-a-Box. With 2 charges, he's guaranteed to spring next combat.
 

roippi

Developer
For reference sake, with the Organ Grinder, what would it be counting exactly, the number of pie parts he's collected?

Yeah. Basically another way to access _piePartsCount.

Also, another familiar that could use this is the Jack-in-a-Box. With 2 charges, he's guaranteed to spring next combat.

Sure, that works.
 

roippi

Developer
r10732 adds charpane decoration for siphons used.

I briefly toyed with the idea of colorizing the text to match the medium's aura, but it didn't add to anything, was distracting, and creates another hurdle for colorblind folk.
 

roippi

Developer
To do: $familiar[medium].image should return the medium's current image.

We now update KoLCharacter.currentFamiliarImage when we see it on the charpane (or api.php), but I believe we also need to update the FamiliarDatabase.familiarImageById hashmap, which is what the proxy field looks at. I won't be able to get to this for a few days, if another dev wants to grab it.
 

Bale

Minion
r11010 adds the initiative bonus. We've got all 66 drinks added as well so I think it is time to finally mark this content implemented.
 

Ruby Eyes

Member
Well, it is lacking some plurals.
(I hope I don't get scolded this time for reusing an old thread instead of making a new one - never quite know where to put stuff!)

Unrecognized item found: 2 Dracs & Tans
You acquire Dracs & Tans (2)

Unrecognized item found: 2 Faunas Libres
You acquire Faunas Libres (2)

Unrecognized item found: 2 More Humanitinis than Humanitinis
You acquire More Humanitinis than Humanitinis (2)

Also, I didn't know mafia would be doing a best guess:
You acquire Thwaitgold grasshopper statuette (2)
Wrong. KoL says,
You acquire 2 Grasshoppers



All those are also not shown in the "Session Results" with their booze quality colors, but black (that's how I noticed this).
 
Last edited:
Top