Bug - Fixed Session log, monster name mismatch.

Bale

Minion
Code:
[516] The Filthworm Queen's Chamber
Encounter: the queen filthworm

Proper name for the monster is "queen filthworm"

As usual, it is BatBrain's fault that such a thing was noticed.
 

Veracity

Developer
Staff member
Well, I assume that KoL itself has "the queen filthworm" in the monname span, or something. If so, we'll just have to adjust it, via consequences.txt, for example. It'd be nice to confirm that there's not something else going on, though.
 

Veracity

Developer
Staff member
Just to be clear, here: the name of the monster given on the "Encounter" line will be whatever KoL says is the monster name in its "monname" span. That does not necessarily agree with what the "official" name of the monster is, as shown by Manuel, or for how we disambiguate monsters with duplicate names. It often includes an article, for example. I mention this, because you showed me this:

Code:
[516] The Filthworm Queen's Chamber
Encounter: the queen filthworm
As if it were evidence of a bug. It is not. When I saw that, I immediately assumed that KoL had put "the queen filthworm" in the "monname" span, and we logged it, as usual. However, when I looked in my own session log for such a monster, I found this:

Code:
[724] The Filthworm Queen's Chamber
Encounter: the queen filthworm
Round 0: Veracity wins initiative!
Round 1: Veracity casts THRUST-SMACK!
Round 2: the queen filthworm takes 311 damage.
... and since the name of the monster taking damage did not agree with the monster in monsters.txt, that was odd.

Let's take a look at some other monsters where the Encounter line is not the "official" monster name.

Code:
[1479] Exposure Esplanade
Encounter: Randy Black, the Iceman who Cometh
Round 0: Veracity wins initiative!
Round 1: Veracity casts SAUCEGEYSER!
Round 2: cold hobo takes 5404 damage.
Round 2: cold hobo takes 100 damage.
Hobos have names.

Code:
[2101] Dreadsylvanian Castle
Encounter: Prisoner #719782: "Two Clavicle" Moore
Round 0: Veracity wins initiative!
Round 1: Veracity executes a macro!
Round 1: Veracity attacks!
Round 2: sleaze skeleton takes 496 damage.
So do Dreadsylvania monsters.

Code:
[10613] Sloppy Seconds Diner
Encounter: Honey Blasted Baked Strawberry Luxurious Sundae
Round 0: Veracity wins initiative!
Round 1: Veracity executes a macro!
Round 1: Veracity tries to steal an item!
Round 2: Veracity casts POCKET CRUMBS!
Round 3: sloppy seconds sundae drops 133 attack power.
Round 3: sloppy seconds sundae drops 69 defense.
Spring Break Beach monsters.

Code:
[4143] The Copperhead Club
Encounter: Harper Collins the bartender
Round 0: Veracity wins initiative!
Round 1: Veracity attacks!
Round 2: copperhead club bartender takes 759 damage.
Copperhead Club bartenders.

Now, there are some that I don't quite understand.

Code:
[240] The Haunted Storage Room
Encounter: portrait of Countess Minerva Spookyraven
Round 0: Veracity wins initiative!
Round 1: Veracity attacks!
Round 2: portrait of Countess Minerva Spookyraven takes 164 damage.
Really? I thought we disambiguated that to "ancestral Spookyraven portrait".

Code:
[618] Video Game Level 3
Encounter: diseased skeleton vice-president
Round 0: Veracity wins initiative!
Round 1: Veracity casts CLUB FOOT!
Round 2: diseased skeleton vice-president drops 15 defense.
Round 2: diseased skeleton vice-president takes 39 damage.
That should be "Video Game Minion (strong)".

Code:
[1978] The Roman Forum
Encounter: Abacus Flavius the Gladiator
Round 0: Veracity wins initiative!
Round 1: Veracity executes a macro!
Round 1: Veracity tries to steal an item!
Round 2: Trorg yaps loudly and repeatedly at your opponent until he throws some meat at him to shut him up.
Round 2: You gain 8 Meat.
Round 2: Elvis Grrl gives him an atomic wedgie. He takes 35 damage and blushes deeply.
Round 2: Abacus Flavius the Gladiator takes 35 damage.
Ditto for gladiator.

Now, since I am certain that all of those register correctly in the Encounters panel - we see "gladiator (15)", for example as the monsters, rather than all the different names - and when you encounter the creature in the Relay Browser, we show you item drops and stats and such, even without Manuel, we are clearly identifying the monster correctly.

I guess the question is what the lastEncounter setting has - and what monster we pass to consult scripts.

Studying the complicated code, I see that AdventureRequest.registerEncounter returns the disambiguated name, GenericRequest.processResponse sets this.encounter to the result of that and calls FightRequest.updateCombatData with this.encounter, and that last method calls MonsterStatusTracker.setNextMonsterName with CombatActionManager.encounterKey( encounter ) - which is the canonicalized article-removed monster name. That is sufficient to set MonsterStatusTracker.monsterData to the correct monster.

We pass the correct monster to consult scripts.
However, lastEncounter contains the original monster name, as logged in the Encounter line, rather than the actual monster name.

So, if a consult script is using the monster name it is given as a parameter, it will work correctly.
If it uses lastEncounter or (gasp) looks at the Encounter line in the session log for some reason, it will have to disambiguate it itself.

Looking at fight logging, it seems like some of it uses lastEncounter and some of it actually uses the last monster.
That seems odd. I don't see any reason it shouldn't always use the last monster.
I also don't see why we shouldn't set lastEncounter to the actual monster name when we set the last monster.

I'm out of turns for today, but I'll play with that tomorrow.

I have to assume that that is actually the essence of what you are reporting, with this bug report. I have no reason to believe that we don't actually recognize the queen filthworm correctly. It is, as the title of this Bug Report says, an issue with what we print in the session log.
 

Veracity

Developer
Staff member
Actually, I think all the Dread monsters and hobos and such that logged correctly as the resolved monster were from older logs. I think we/I changed the session logging to print lastEncounter rather than the name of the last monster relatively recently.

If somebody has access to a Hobopolis or Dreadsylvania instance, I'd be curious (and grateful) to see what the session log says today for a monster in such a place.

And I will fix fight logging to always use the monster name of the last monster, not lastEncounter.

I also notice that ASH last_monster() gets the last (current) monster from the MonsterStatusTracker, not lastEncounter, so that is Yet Another Way that a consult script can get the monster it is fighting, rather than using the session log. I still can't think of any reason why going to the session log during combat would be useful; aside from going to disk (or at least the OS, if it is caching the last write, or something) being slower than using in-memory data, I am sure the data that is needed is available via ASH calls already.
 

xKiv

Active member
If somebody has access to a Hobopolis or Dreadsylvania instance, I'd be curious (and grateful) to see what the session log says today for a monster in such a place.

Just updated from svn, 15731.

session log (the file) says:
Code:
[1244] Dreadsylvanian Castle
Encounter: Belladonna Grimbelch
Round 0: xKiv wins initiative!

last_monster() is stench vampire.


I also notice that ASH last_monster() gets the last (current) monster from the MonsterStatusTracker, not lastEncounter, so that is Yet Another Way that a consult script can get the monster it is fighting, rather than using the session log.

For some reason, I though batbrain wants to know what happened even before the current fight.


ETA: actually, I wonder if logging the "real" encounter name *in addition to* the canonicalized monster name (if different) could be helpful to someone. Like spading name patterns or something. But then, people can always print lastEncounter in betweenbattlescript, of course.
 
Last edited:

Veracity

Developer
Staff member
ETA: actually, I wonder if logging the "real" encounter name *in addition to* the canonicalized monster name (if different) could be helpful to someone. Like spading name patterns or something. But then, people can always print lastEncounter in betweenbattlescript, of course.
Try revision 15734.

Code:
[532344] The Haunted Storage Room
Encounter: portrait of Count Ezekiel Y. Spookyraven
Round 0: Brianna wins initiative!
Round 1: Brianna attacks!
Round 2: ancestral Spookyraven portrait takes 2940 damage.
Round 2: Brianna wins the fight!
You gain 8 Beefiness
You gain 4 Magicalness
You gain 12 Roguishness
The Encounter is whatever KoL tells us inside the "monname" span, as before.
Monster actions logged thereafter are the "official" name of the monster, taken from the same place ASH uses to get last_monster().
 

Bale

Minion
This appears to be a solved issue, but for completeness I'm going to report on today's encounter with the queen filthworm.

> version

KoLmafia v16.8 r15734

[503] The Filthworm Queen's Chamber
Encounter: the queen filthworm
Round 0: Bale wins initiative!
You lose 1 hit point

> ashq last_monster().print()

queen filthworm

> get lastEncounter

the queen filthworm

And here's the HTML:

HTML:
<body>
<img src='/images/itemimages/blank.gif' id='dragged'><div id='debug'></div><div class=contextmenu id='skillmenu'></div><div class=contextmenu id='itemsmenu'></div><div id=topbar><center><table class=actionbar cellpadding=0 cellspacing=1><tbody><tr class=label><td></td><td></td><td></td><td></td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>0</td><td>–</td><td>=</td><td></td><td></td><td></td></tr><tr class=blueback><td><a href='fight.php?action=custom'><img src='/images/itemimages/plexpock.gif'></td><td class=spacer></td><td><img src='/images/itemimages/book3.gif' id='skills'></td><td class=spacer></td><td><img src='/images/itemimages/blank.gif' id='button1'></td><td><img src='/images/itemimages/blank.gif' id='button2'></td><td><img src='/images/itemimages/blank.gif' id='button3'></td><td><img src='/images/itemimages/blank.gif' id='button4'></td><td><img src='/images/itemimages/blank.gif' id='button5'></td><td><img src='/images/itemimages/blank.gif' id='button6'></td><td><img src='/images/itemimages/blank.gif' id='button7'></td><td><img src='/images/itemimages/blank.gif' id='button8'></td><td><img src='/images/itemimages/blank.gif' id='button9'></td><td><img src='/images/itemimages/blank.gif' id='button10'></td><td><img src='/images/itemimages/blank.gif' id='button11'></td><td><img src='/images/itemimages/blank.gif' id='button12'></td><td valign=center align=center class=page><a class=nounder href='javascript:pageup();'><img src='/images/otherimages/tinyup.gif' class=updown></a><br><span id='page_out'></span><br><a class=nounder href='javascript:pagedown();'><img src='/images/otherimages/tinydown.gif' class=updown></a></td><td class=spacer></td><td><img src='/images/itemimages/backpack.gif' id='items'></td></tr><tr class=label><td>script</td><td></td><td>skills</td><td></td><td id='qty1'></td><td id='qty2'></td><td id='qty3'></td><td id='qty4'></td><td id='qty5'></td><td id='qty6'></td><td id='qty7'></td><td id='qty8'></td><td id='qty9'></td><td id='qty10'></td><td id='qty11'></td><td id='qty12'></td><td></td><td></td><td>items</td></tr></tbody></table></center></div><div class=content id='content_'><div id='effdiv' style='display: none'></div><div style='overflow: auto'><center><!--faaaaaaart--><table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Combat: Round 1, Fight 1!</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><center><table><tr><td><div id=monsterpic style='position: relative;'>	<img id='monpic' src="/images/adventureimages/filthworm4.gif" width=100 height=100></div></td><td valign=center>You're fighting <span class="elementstench" id='monname'>the queen filthworm</span><font size=2 color=gray><br />HP: 245, Atk: 223, Def: 184, Type: bug<br />Drops: heart of the filthworm queen (100)</font></td><td width=30></td><td><table><tr><td width=30><img src=/images/itemimages/nicesword.gif width=30 height=30 alt="Enemy's Attack Power" title="Enemy's Attack Power"></td><td width=50 valign=center align=left><b><font size=+2>223</font></b></td><td><img src=/images/itemimages/stinkbug.gif alt="This monster is a Bug" title="This monster is a Bug"></td></tr><tr><td width=30><img src=/images/itemimages/whiteshield.gif width=30 height=30 alt="Enemy's Defense" title="Enemy's Defense"></td><td width=50 valign=center align=left><b><font size=+2>184</font></b></td><td><img src=/images/itemimages/stench.gif width=30 height=30 alt="This monster is Stinky.  Stench is weak against Cold and Sleaze." title="This monster is Stinky.  Stench is weak against Cold and Sleaze."></td></tr><tr><td width=30><img src=/images/itemimages/hp.gif width=30 height=30 alt="Enemy's Hit Points" title="Enemy's Hit Points"></td><td width=50 valign=center align=left><b><font size=+2>245</font></b></td><td><img src=/images/itemimages/watch.gif alt="Initiative +50%" title="Initiative +50%"></td></tr></table></td></tr></table><br><script type="text/javascript">var monsterstats = {"hp":"245","def":"184","off":"223"};</script></center><blockquote>This is the queen of all filthworms.  I guess if you have to be a filthworm, it's better to be the queen than just a regular drone, but not quite as good as not being a filthworm at all.  She's bigger than the other filthworms, wears a crown made of green goo, and the stench -- well, have you ever been out in a rose garden on a nice spring day, wearing clothes fresh from the dryer and really expensive cologne, and then you walk under a window ledge with a freshly baked apple pie cooling on it?<p>
<p>
Well, her smell is the exact opposite of that.</blockquote><center><p><p>You get the jump on her.<p>You gag as you approach her.  What a stench!<center><table><tr><td><img src="/images/itemimages/hp.gif" height=30 width=30></td><td valign=center class=effect>You lose 1 hit point. (<font color=green><b>stench damage</b></font>)</td></tr></table></center><div id='fightform' class='hideform'><p><center><table><a name="end"><form name=attack action=fight.php method=post><input type=hidden name=action value="attack"><tr><td align=center><input id='tack' picurl=obsnutcracker onclick="return killforms(this)"  class=button type=submit value="Attack with your obsidian nutcracker"></td></tr></form></a><form name=useitem action=fight.php method=post><input type=hidden name=action value="useitem"><tr><td align=left><select name=whichitem><option value=0>(select an item)</option><option picurl=adder value=6713>adder (1)</option><option picurl=poisoncup value=829>anti-anti-antidote (4)</option><option picurl=beer value=2350>beer bomb (3)</option><option picurl=matchbook value=6683>book of matches (1)</option><option picurl=cast value=474>cast (3)</option><option picurl=ramekin value=6282>chipotle wasabi cilantro aioli (3)</option><option picurl=disease value=452>disease (1)</option><option picurl=camera value=7266>disposable instant camera (1)</option><option picurl=potion4 value=2091>fancy bath salts (1)</option><option picurl=hairwad value=1922>gob of wet hair (3)</option><option picurl=spirit value=1939>grouchy restless spirit (3)</option><option picurl=cloaca value=7788>ice-cold Cloaca Zero (1)</option><option picurl=inkwell value=1958>inkwell (2)</option><option picurl=firecrack value=747>Knob Goblin firecracker (1)</option><option picurl=seltzer value=344>Knob Goblin seltzer (4)</option><option picurl=leftovers value=1777>leftovers of indeterminate origin (2)</option><option picurl=bandage1 value=7975>linen bandages (2)</option><option picurl=molotov value=2400>molotov cocktail cocktail (2)</option><option picurl=padl value=2065>PADL Phone (1)</option><option picurl=torpedo value=630>photoprotoneutron torpedo (1)</option><option picurl=potion1 value=610>procrastination potion (1)</option><option picurl=wine value=7980>sacramental wine (3)</option><option picurl=tooth value=2>seal tooth (1)</option><option picurl=shortwrit value=6711>short writ of habeas corpus (1)</option><option picurl=bandage3 value=7977>silk bandages (3)</option><option picurl=tal_r value=8136>talisman of Renenutet (8)</option><option picurl=teqgrenade value=2068>tequila grenade (1)</option><option picurl=potion5 value=469>wussiness potion (1)</option><option picurl=yeinsult value=6278>Ye Olde Medieval Insult (4)</option></select> <input class=button type=submit onclick="return killforms(this);" value="Use Item"></td></tr></form><form name=skill action=fight.php method=post><input type=hidden name=action value="skill"><tr><td align=center><select name=whichskill><option value='none'>(select a skill)</option><option value="7246" picurl="lb_stink" >Summon Love Stinkbug (0 Mana Points)</option><option value="7247" picurl="lb_gnats" >Summon Love Gnats (0 Mana Points)</option><option value="7248" picurl="lb_scarab" >Summon Love Scarabs (0 Mana Points)</option><option value="17007" picurl="krakfist" >Fist of the Mummy (5 Mana Points)</option><option value="17008" picurl="jackalhead" >Howl of the Jackal (10 Mana Points)</option><option value="17012" picurl="cobrahead" >Lash of the Cobra (12 Mana Points)</option><option value="17010" picurl="scarab" >Storm of the Scarab (8 Mana Points)</option><option value="17009" picurl="lionface" >Roar of the Lion (15 Mana Points)</option><option value="17013" picurl="sun" >Wrath of Ra (40 Mana Points)</option><option value="17019" picurl="jetplane" >Curse of Vacation (30 Mana Points)</option><option value="17018" picurl="kacoin" >Curse of Fortune (1 Ka coin)</option><option value="17014" picurl="marshmallow" >Curse of the Marshmallow (2 Mana Points)</option><option value="17016" picurl="gooball" >Curse of Yuck (5 Mana Points)</option><option value="17017" picurl="familytree" >Curse of Heredity (10 Mana Points)</option><option value="17015" picurl="confused" >Curse of Indecision (5 Mana Points)</option><option value="17020" picurl="stench" >Curse of Stench (35 Mana Points)</option><option value="17047" picurl="exclam" >Mild Curse (0 Mana Points)</option></select> <input class=button type=submit onclick="return killforms(this);" value="Use Skill"></td></tr></form><form name=macro action=fight.php method=post><input type=hidden name=action value="macro"><input type="hidden" name="macrotext" value=""><tr><td align=center><select name=whichmacro><option value='0'>(select a macro)</option><option value="80723" picurl="grimglaive" >Spam Attack</option><option value="81441" picurl="vampirefangs" >Spam Infection</option><option value="134959" picurl="dv_mark6" >Stasis 'till I Die</option><option value="18415" picurl="heboulder" >Yellow Ray</option></select> <input class=button type=submit onclick="return killforms(this);" value="Execute Macro"></td></tr></form><form name=runaway action=fight.php method=post><input type=hidden name=action value="runaway"><tr><td align=center><input class=button onclick="return killforms(this);" type=submit value="Run Away"></td></tr></form></table></center></div><br><a href='#' onclick='document.getElementById("fightform").className="showform"; document.getElementById("formlink").style.display = "none";' id='formlink' class=tiny>(show old combat form)</a></td></tr></table></center></td></tr><tr><td height=4></td></tr></table><!--faaaaaaart--></center></div></div><script>var pwd="23db18f3e2f457efe2a5da06be0461ae";</script><script src='/images/scripts/actionbar.20140514.js'></script></body>

I'll finish the fight just so we can see the change in this version.

Round 1: Bale casts SUMMON LOVE SCARABS!
Round 2: queen filthworm takes 20 damage.
You gain 6 Mana Points
Round 2: Bale casts CURSE OF FORTUNE!
Round 3: queen filthworm takes 4 damage.
You lose 67 hit points
Round 3: Bale casts STORM OF THE SCARAB!
Round 4: queen filthworm takes 725 damage.
Round 4: Bale wins the fight!
After Battle: Temsebbekeepes tidies up the room, clearing away any dust or loose scraps of meat.
You gain 3533 Meat
You acquire an item: heart of the filthworm queen
You acquire an item: Ka coin
You gain 15 Beefiness
You gain 43 Wizardliness
You gain 14 Smarm
 

xKiv

Active member
The Encounter is whatever KoL tells us inside the "monname" span, as before.
Monster actions logged thereafter are the "official" name of the monster, taken from the same place ASH uses to get last_monster().

In that case, I don't understand what was getting fixed. "Official" name (last_monster) still isn't guaranteed to be logged at all (if I, say, run away before it does anything? I think?), especially not in an easy-to-find location, which is what automatic parsing of session logs would care about (not just batbrain).


> ashq last_monster().print()

Why so complicated? That could have been just
Code:
> last_monster
 
Last edited:

Veracity

Developer
Staff member
Exactly. This is the Encounter:

Code:
<span class="elementstench" id='monname'>the queen filthworm</span>
Note that the lastEncounter setting has what KoL told us and last_monster() has the resolved monster.

That was not a change; this was just an issue with the session log.
 

heeheehee

Developer
Staff member
Hm. Actually, can we have to_monster(string) attempt to resolve the string available in lastEncounter? I know that it wouldn't have, say, monster image or description to go off of, but it seems like it could be useful for the various people who want to check if the lastEncounter was a combat.
 
Top