New Content MONSTERID in fights.

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I think people just don't realise. I added current_round() a while ago just to give you what mafia believes the current round is, I see if I'm in a flight by checking if it is 0
 

fronobulax

Developer
Staff member
Because run_combat() didn't always exist. I'm still in the habit of telling mafia to adventure somewhere when I should say run_combat(). I use a place which I can't get to (and mafia doesn't know that), because I don't want to accidentally waste a turn in the noob cave.

I have a similar recollection. bccasend dates back to 2010 and my recollection is that it used the technique and somewhere there was a comment and documentation that said appearing to adventure in the Noob Cave but not really doing so was normal and expected. Looking at SVN annotation, I'd argue that run_combat() was finalized in 2015 so there is a potential of 5 years when run_combat() didn't exist.
 

Veracity

Developer
Staff member
Looking at SVN annotation, I'd argue that run_combat() was finalized in 2015 so there is a potential of 5 years when run_combat() didn't exist.
I don't know what "finalized" means, but the oldest SVN commit not that mentions run_combat is this:

Code:
r8994 | veracity0 | 2011-02-01 18:02:16 -0500 (Tue, 01 Feb 2011) | 4 lines

Adjust with of Monster category in Fax Request Frame.
Allow run_combat to finish combat even when the CCS has a consult script which
didn't finish the combat.

I also notice this:

Code:
r15235 | lostcalpolydude | 2015-01-19 13:23:44 -0500 (Mon, 19 Jan 2015) | 3 lines

Add buffer run_choice( int ) command.  When in a choice adventure, use this to submit the selected option. 
With -1 as imput, it will automate the rest of the choice using existing settings.

Also add run_turn(), which will work as run_combat() or run_choice( -1 ) depending on whether you are in combat or in a choice.
Nice job, lost! I've never actually used run_turn(), but there it is.

THere are a few things to be done.

1) Strip off random modifiers and save in array for later use before checking MONSTERID
2) If there is no MONSTERID, run encounter through consequence manager and attempt to look up the monster by name. This does not have all the special little hoops we used to have to jump through.
3) Report bug/suggestion to KoL to put MONSTERID onto the fight page you get when you "twiddle your thumbs".
4) Do not log a new adventure/encounter if we are currently in a fight.

Revision 20168 does 1 & 2. With that, I did the following in the Relay Browser:

- Started a fight in Barf Mountain
-- used seal tooth
- Clicked on The Goatled in the adventure locations in the char pane
-- used seal tooth
-- finished fight

Code:
[9850] Barf Mountain
Encounter: angry tourist
Round 0: Veracity wins initiative!
Round 1: Veracity uses the seal tooth!
Round 2: angry tourist takes 1 damage.
Round 2: angry tourist drops 3 attack power.
Round 2: angry tourist drops 4 defense.

[9850] The Goatlet
KoLmafia thinks it is round 3 but KoL thinks it is round 2
Round 2: Veracity uses the seal tooth!
Round 3: angry tourist takes 1 damage.
Round 3: angry tourist drops 4 attack power.
Round 3: angry tourist drops 3 defense.
Round 3: You lose 1 hit point
Round 3: Veracity attacks!
Round 4: angry tourist takes 1261 damage.
Round 4: angry tourist drops 2 attack power.
Round 4: angry tourist drops 3 defense.
Round 4: Veracity wins the fight
Notice that it was able to figure out the monster from name, even in absence of MONSTERID.

When we get #4, the following lines will not be there, we will not have to figure out the monster, the adventure location will remain unchanged, and so on:

Code:
[9850] The Goatlet
KoLmafia thinks it is round 3 but KoL thinks it is round 2
 

Veracity

Developer
Staff member
I think people just don't realise. I added current_round() a while ago just to give you what mafia believes the current round is, I see if I'm in a flight by checking if it is 0
Yeah, this is nice. My God Lobster script I posted was written several years ago and looks for fight.php or choice.php in the result from visit_url. I could modernize it to use current_round() and handling_choice() to do the same thing without doing string searches.
 

Veracity

Developer
Staff member
I submitted a bug report to KoL, asking for MONSTERID in "you twiddle your thumbs" fight redirections. (#3)
And revision 20169 will not register requests (other than fight.php) if you are in the middle of a fight. (#4)

Code:
[9851] Barf Mountain
Encounter: garbage tourist
Round 0: Veracity wins initiative!
Round 1: Veracity uses the seal tooth!
Round 2: garbage tourist takes 1 damage.
Round 2: garbage tourist drops 3 attack power.
Round 2: garbage tourist drops 3 defense.
KoLmafia thinks it is round 3 but KoL thinks it is round 2
KoLmafia thinks it is round 3 but KoL thinks it is round 2
Round 2: Veracity uses the seal tooth!
Round 3: garbage tourist takes 1 damage.
Round 3: garbage tourist drops 3 attack power.
Round 3: garbage tourist drops 3 defense.
KoLmafia thinks it is round 4 but KoL thinks it is round 3
Round 3: Veracity uses the seal tooth!
Round 4: garbage tourist takes 1 damage.
Round 4: Veracity attacks!
Round 5: garbage tourist takes 1260 damage.
Round 5: Veracity wins the fight!
Each of those "KoLmafia thinks it is round X but KoL thinks it is round X-1" lines was a redirection:

- I clicked on the Last Adventure link
- I clicked on the "Last Adventure" heading, which goes to the container document
- I clicked on campground in the top menu.

In every case, I "twiddled my thumbs" and we remained in the same round of the fight.

I still want MONSTERID in the thumb twiddling redirections, since we would like to use it when you log in and are redirected immediately into a fight, but hopefully this change takes care of the Noob Cave situation - as well as not changing your adventure location to the Noob Cave and messing up the logging.
 

Aenimus

Member
Just want to add that CDM will implement MONSTERID in each combat round. I don't know when, but I'm hoping Monday or before.
 

Veracity

Developer
Staff member
Revision 20175 sets the last_monster() at the time it creates the MonsterData from MONSTERID and responseText. And when you use CLEESH, it transforms the monster appropriately.

Looking at Monster Changing on the WIki, there are nine different ways to do that. Near as I can tell, we only recignize CLEESH in-battle and transformed it in-place. I'm going to experiment more with this once MONSTERID is in every combat round.

I also tried CLEESH while wearing dice gear. It changes the monster in place, but you get new OCRS modifiers which are not visible until the next round.

Code:
You're fighting <span id='monname'>a tiny, shaky, restless, askew, stingy, ticking wailing mushroom guy</span>
<script>var ocrs = ["tiny","shakes","zoom","askew","stingy","ticking"];</script>
<script>newpic("https://s3.amazonaws.com/images.kingdomofloathing.com/adventureimages/salamander.gif", "a salamander",100,100);</script>
You cast CLEESH at your opponent. It turns into a salamander.
KoL uses Javascript to transform the monster picture, but the new set of modifiers are not set, the new picture uses the old modifiers, and the new monster is simply "a salamander", rather than "a this, that, other thing salamander". If you force a twiddle, you will see the monster with the new random modifiers and image.

It would probably be pointless to submit a KoL bug report about this - although it affects regular browser play (I tested that); it's not a KoLmafia issue.

Next round:

Code:
You're fighting <span id='monname'>a tiny, short, turgid, artisanal, American, cloud-based salamander</span>
<script>var ocrs = ["tiny","short","turgid","artisanal","patriotic","cloud"];</script>
You scratch your opponent with your seal tooth, doing 1 damage.
No MONSTERID, although there will be, by and by. But this monster has the new monster name and the new OCRS variables.

Which is to say, unless KoL changes, you don't get to see the new OCRS variables until the round after the monster was transformed.

We don't currently extract the MonsterData from the fight HTML, but we'll need to do that the following round after the you transform a monster.
I'll look more at this once MONSTERID is in every round.
 

Veracity

Developer
Staff member
Thanks! I had a workaround in place for twiddling thumbs, but logging out/in during a fight needed my "look up monster by name" kludge.
I tested that case with "the Angels of Avalon" (which are really "Angels of Avalon"), which was an issue before.
I also reinstated dumping the fight responseText to the DEBUG log if we get a fight with no MONSTERID that is not "the darkness".
It all worked as desired; we identified te monster at login using the MONSTERID.

Revision 20187.
 

Veracity

Developer
Staff member
I just submitted the following Bug Report to KoL. I'm not sanguine they'll do anything about it. It is a user-visible bug, but is pretty niche, at this point. Maybe if it'd been reported during OCRS.
Something I noticed is that in the round when you transform the monster, they DO give you the new Atk/Def/HP.
We could use that even if we don't reparse new random modifiers - which are not yet provided, during that round.

Code:
There is an issue when you transform a monster with random modifiers.
The random modifiers are rerolled for the new monster.
In the response to the transformation:
It displays the original monster with original modifiers
Manuel lists the new Atk/Def/HP but the original phylum/element/init
It changes the monster name and image in-place with Javascript.
--> The new name does not include the new modifiers
--> The new image is rendered using the old modifiers.
--> Manuel already had the new Atk/Def/HP, but still displays the old phylum/element/init
If you reload the page (twiddle), you get to see the new monster with the new modifiers.
Alternatively, you can just do a combat action and will see them next round.

That's not really advised; you'd prefer to choose your combat action based on the new modifiers.

-------
I equipped six pieces of dice gear and an Intergnat.
I adventured in The Hippy Camp (Bombed back to the Stone Age)

You're fighting an Australian, floating, broke, drunk, turgid, narcissistic caveman hippy NAMED NEIL
(Atk = 241 Def = 321 HP = 1,403 Hippy Stinky 20% Init)
cast Macrometeorite
(Atk = 250 Def = 207 HP = 260 Hippy Stinky 20% Init)
You're fighting a cavewomyn hippy
(Reload page - twiddle my thumbs)
You're fighting a left-handed, bouncing, askew, wet, American, frozen cavewomyn hippy WITH BACON!!!
(Atk = 250 Def = 207 HP = 260 Hippy Cold 25% Init)
cast CLEESH
(Atk = 3 Def = 2 HP = 3 Hippy Cold 25% Init)
You're fighting a newt
(Reload page - twiddle my thumbs)
(Atk = 3 Def = 2 HP = 3 Beast No element Never wins initiative)
You're fighting a tiny, cartwheeling, twirling, short, narcissistic, obscene newt WITH BACON!!!
-------

Looking at the HTML of those requests, here is what happens when I transform a monster:

fight.php?action=skill&whichskill=7290
You're fighting <span id='monname'>an Australian, floating, broke, drunk, turgid, narcissistic caveman hippy NAMED NEIL</span><!-- MONSTERID: 471 -->
<script type="text/javascript">var monsterstats = {"hp":"260","def":"207","off":"250"};</script>
<script>var ocrs = ["flip","floating","broke","drunk","appendimg:adventureimages\/ol_drunk.gif:0:0","turgid","narcissistic"];</script>
<script>newpic("https://s3.amazonaws.com/images.kingdomofloathing.com/adventureimages/cavewomyn.gif", "a cavewomyn hippy",100,100);</script>
You quickly step to the side, and the massive meteorite that was about to hit you instead hits your opponent, knocking them out of the way.  You wander off to fight something else.

postwarisland.php
redirect to: fight.php
You're fighting <span id='monname'>a left-handed, bouncing, askew, wet, American, frozen cavewomyn hippy WITH BACON!!!</span><!-- MONSTERID: 472 --
<script type="text/javascript">var monsterstats = {"hp":"260","def":"250","off":"341"};</script>
<script>var ocrs = ["mirror","bouncing","askew","wet","appendimg:adventureimages\/water5.png:0:0","patriotic","frozen","appendimg:adventureimages\/ice_overlay.png:0:0"];</script>
You twiddle your thumbs.

fight.php?action=skill&whichskill=15
You're fighting <span id='monname'>a left-handed, bouncing, askew, wet, American, frozen cavewomyn hippy WITH BACON!!!</span><!-- MONSTERID: 472 -->
<script type="text/javascript">var monsterstats = {"hp":"3","def":"2","off":"3"};</script>
<script>var ocrs = ["mirror","bouncing","askew","wet","appendimg:adventureimages\/water5.png:0:0","patriotic","frozen","appendimg:adventureimages\/ice_overlay.png:0:0"];</script>
<script>newpic("https://s3.amazonaws.com/images.kingdomofloathing.com/adventureimages/newt.gif", "a newt",100,100);</script>
You cast CLEESH at your opponent. She turns into a newt.

postwarisland.php
redirect to: fight.php
You're fighting <span id='monname'>a tiny, cartwheeling, twirling, short, narcissistic, obscene newt WITH BACON!!!</span><!-- MONSTERID: 333 -->
<script type="text/javascript">var monsterstats = {"hp":"0","def":"2","off":"1"};</script>
<script>var ocrs = ["tiny","spinning","rotate","short","narcissistic","obscene","appendimg:adventureimages\/ol_censored.png:0:0"];</script>
You twiddle your thumbs.

----

Notice the issues, as the user sees them (until twiddle or next round)

Started out with an Australian, floating, broke, drunk, turgid, narcissistic caveman hippy NAMED NEIL
(Hippy, Stinky, Init 20)

Replaced with a left-handed, bouncing, askew, wet, American, frozen cavewomyn hippy WITH BACON!!!
--> The new random modifiers are not displayed
--> Says it is a Hippy - which is still true
--> Says it is Stinky, but it's really Cold
--> Says Init is 20% but is really 25%

Replaced with a tiny, cartwheeling, twirling, short, narcissistic, obscene newt WITH BACON!!!
--> The new random modifiers are not displayed
--> Says it is a Hippy, but it's really a Beast
--> Says it is Cold, but it's really (no element)
--> Says Init is 25% but is really (never wins initiative)
 

Crowther

Active member
I'm getting errors in The Haiku Dungeon.
Code:
[13920] The Haiku Dungeon
Encounter: Knob Goblin poseur
MONSTERID not found
A sausage goblin that showed up was recognized fine.
 

Veracity

Developer
Staff member
I've been experimenting with ways to transform a monster (CLEESH, Macrometeorite, CHEAT CODE: REPLACE MONSTER) and attempting to figure out what the new monster is before you sibmit an action and get the new response text. We will re-read MONSTERID from the next responseText, and we will accurately know what the monster is, but you'd probably like to know what the monster is before you submit the next action. Twiddling your thumbs will count as an action, but it's an extra step.

What we used to do:

Leave last_monster() unchanged and discover the actual monster next round.

What we do now:

Attempt to look up the new monster by name (which is provided).
If found, cool.
If ambiguous, attempt to look up the new monster by image (which is provided)
If found, take it - but images are shared, so no guarantees.

This is revision 20208.

I submitted a Bug Report to KoL asking for MONSTERID to be included in the argument list for newpic(), the Javascript function KoL uses itself to change the image on the page. We'll see how they respond.

Code:
I've been diving into transforming monsters and how to recognize which monster you end up with.

tl;dr: I'd like you to include MONSTERID as an argument to the newpic() Javascript function.

It works like this.

I am in fight.php. I see monster X.
I submit an action which transforms the monster - CLEESH, CHEAT CODE: REPALCE MONSTER, Macrometeorite, etc.
The response shows me the picture of monster X - and MONSTERID is for X.
The text says that the monster is replaced. Depending on the skill, it may tell you what the new monster is. CLEESH does, CHEAT CODE: REPLACE ENEMY does not.
The following script runs:

newpic("/iii/adventureimages/newt.gif", "a newt",100,100);
newpic("/iii/adventureimages/fratboy.gif", "an Orcish Frat Boy",100,100);
newpic("/iii/adventureimages/darkness.gif", "the darkness",100,100);

Those are 3 examples. It is not really "/iii", although it could be.

So How do I tell, for sure, what the new monster is? MONSTERID on the page is the old monster.
The response to the next action - which could twiddling your thumbs - has the new MONSTERID.
So that is the guaranteed way to tell what the replacement monster is. Unfortunately, it requires an action.

How about looking up the monster by name? That works for "a newt", but there multiple Orcish Frat Boys:

62 = fratboy.gif
63 = fratboy.gif
64 = fratskirt.gif
527 = fratboy.gif (War Pledge)

(War Pledge shares the same image, which makes looking up by image even more complicated.)

Similarly for Ninja Snowman:

338 = ninjarice.gif
137 = snowman.gif
100 = snowman.gif

factory workers and factory overseers and mine workers and mine overseers all have male and female versions - but the images are distinct, at least.

I would like to be able to get the MONSTERID of the transformed monster from the same response text where the transformation happens.

I suggest the following:

Change the signature of the Javascript newpic() function.

newpic("/iii/adventureimages/newt.gif", "a newt",100,100,MONSTERID);
newpic("/iii/adventureimages/fratboy.gif", "an Orcish Frat Boy",100,100,MONSTERID);
newpic("/iii/adventureimages/darkness.gif", "the darkness",100,100,-1);

KoL doesn't need that in order to render the monster transformation, but it would make KoLmafia's life a lot easier.

Thanks for reading this bug report.
 

Veracity

Developer
Staff member
I'm getting errors in The Haiku Dungeon.
Code:
[13920] The Haiku Dungeon
Encounter: Knob Goblin poseur
MONSTERID not found
A sausage goblin that showed up was recognized fine.
I have reproduced this for normal Haiku Denizens.
Also for the sausage golem, whose name is not presented in Haiku, unlike non-wanderers in that location.

There really is no MONSTERID in the response when the monsters are introduced in Haiku.

I submitted a Bug Report to KoL.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
We have haiku monsterids now it seems
 

Aenimus

Member
I've been told that macrometeor, cleesh and other such stuff that changes the monster should automatically and immediately update MONSTERID.
 

Veracity

Developer
Staff member
Thanks!

Revision 20225 will transform a monster when we detect a new MONSTERID in the fight response, rather than we detect the script that changes the monster image - although we still use that to log the new monster in the session log.
 

Aenimus

Member
Last I checked, modifiers and CLEESH were not working on KoL's end.

EDIT: Just saw your bug report. Maybe it was fixed? I'll check about the bug report stuff.
 
Last edited:

Veracity

Developer
Staff member
CLEESH worked - except for the displayed text, which did not have the monster name.
By "modifiers", I assume you mean things like OCRS and Intergnat.
Yes, those are not updated, near as I can tell, until the following round (or a twiddle).
 

Aenimus

Member
CDM says modifiers can't be fixed, sadly. I've mentioned the CLEESH text missing.

EDIT: CLEESH text is fixed!
 
Last edited:

Veracity

Developer
Staff member
Revision 20236 uses MONSTERID to decorate gremlins in the relay browser intelligently: it only says that the gremlin has the tool if it is actually a tool bearing gremlin, and it pinkifies it if it is the specific tool you are looking for.

I think lost mentioned a long time ago that tool bearing gremlins can appear in other parts of the junkyard. I didn't see any examples of that today; the only tool-bearing gremlins were the ones in the area I was directed to search for a particular tool in.

Perhaps if you have a magnet but Yossarian has not directed you to seek out a particular tool, you can find tool-bearing gremlins everywhere?
 
Top