New Content MONSTERID in fights.

Veracity

Developer
Staff member
This post says:

MONSTERID is now included in the HTML. This is mostly for Mafia support. It is intended that darkness and darkness only will obscure MONSTERID (I won't spoil the other good example here).]
and this post says:

Yes, this removes the pain from Gremlins, essentially. It was discussed as one of the main drawbacks of the change, but also just doesn't hold that much impact. New players won't be checking HTML (probably), and if they did, wouldn't know why it was relevant to the quest. That means they can still explore it the "normal way", as can those who don't use Mafia.

People (The ErosionSeeker, etc.) already did something similar by never collecting the Factoids of the "wrong" gremlins.
Very nice.

What do we do now?

AdventureRequet.registerEncounter passes the combat "encounter" and responseText to AdventureRequest.ranslateGenericType.
AdventureRequest.ranslateGenericType goes through a bunch of gyrations to try to figure out which monster it is.
It figures out the MonsterData and returns the monster name as the "encounter".
And then later, in FightRequest, it looks up the monster name and disambiguates it vis consequences.txt.

That seems like a lot of unnecessary processing.

What does translateGenericType to convert "monstername" to MonsterData to an "encounter" string?

- If you are in Fernswarthy's Basement, BasementRequest already genericized it for you.
- If WumpusManager says it's the wumpus, believe that, even if you are blind, for some reason.
- time prank and be any player name, so attempt to look for message
then
- remove OCRS modifiers - add to MonsterData.lastRandomModifiers
- remove intergnat modifications - add to MonsterData.lastRandomModifiers
- handle mutants from Nuclear Autumn - add mutant to MonsterData.lastRandomModifiers
- handle masks - add to MonsterData.lastMask and to MonsterData.lastRandomModifiers
then
- call ConsequenceManager.disambiguateMonster

and then lookup the monster name to get a MonsterData

If we still can't find it,
- look for monsters with synonymous names from LT&T
- look up monster by image
- disambiguate Video Game bosses and minibosses, DMT monsters, etc.

That is immensely complicated, but this KoL fix will let us simplify it a lot

- We still need to do the OCRS/Intergnat/Nuclear Autumn/Disguises Delimit stuff to calculate MonsterData.LastRandomModifiers and MonsterData.lastMask stuff.
- We still need to disambiguate via ConsequenceManager, although the vast majority of monster consequences should not be needed.

If we are given a monster ID we don't know, we can do look it up and learn monster IDs. Hard Mode dreadsylvania monsters, ultrarare monsters, etc., etc.

And if we are calculating MonsterData, anyway, how about if we don't go back and forth between encounter name to MonsterData to encounter name to MonsterData?

This is pretty exciting. Unless gausie has had time to start this, I'll hop onto it.
 

Veracity

Developer
Staff member
Revision 20162 uses MONSTERID.

I confirmed we handle the darkness (blind) correctly.
I confirmed that we can identify all three kinds of Ninja Snowmen and all three finds of Orcish Frat Boys without having to disambiguate through images.

I'll do some more testing with dice equipment and intergnat and so on.
If anyone is doing OCRS, Nuclear Autumn, or Disguise Delimit any time soon, I'd like to know if we are still passing a monster with the expected random modifiers to your consult script.
I'd like to make the IslandDecorator decorate the Junkyard gremlins more usefully, since we now know for sure if they have the tool or not. :)

And I'd like to calculate the MonsterData for the specify monster you are fighting exactly once, when we parse the fight text and have monster ID, rather than going back to a String and then back again to a MonsterData.

So, a fair amount of work left, but this is the core of it. Let's see how it works out for all of you.
 

Veracity

Developer
Staff member
So far, so good:

Code:
[9036] Barf Mountain
Encounter: tie-dyed, bouncing, quacking, turgid, cloud-based, fragile garbage tourist AND TESLA!
Round 0: Veracity wins initiative!

[color=green]> ash last_monster().random_modifiers[/color]

Returned: aggregate boolean [string]
tie-dyed => true
bouncing => true
quacking => true
turgid => true
cloud-based => true
fragile => true
tesla => true
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I'm getting a few monsters come through as if I'm blinded, all triggered by unusual combat triggers - eldritch tentacle and a numberology'd infantryman for example. I didn't check but it's possible that kol isn't setting the monsterid for them. But more likely that we are not registering those encounters properly.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Will get you one asap. I also think we should rename the tooled gremlins to remove the " (tool)" from the end and use square bracket disambiguation for them. Is that already present for monsters as it is for items and skills?
 

Rinn

Developer
I tried to reproduce that this morning with the frat calculate the universe and the two tentacle fights but wasn't able to. Looking at the code if the MONSTERID_PATTERN matcher fails, it will always return The Darkness unless it's the wumpus, so maybe it would be worth updating the code for the moment to save a debug log of the combat page text if the darkness image isn't found as well? It's possible there could be kol bugs since it's a new feature, or maybe it's just something trivial like white space being different in the html comment.
 

Veracity

Developer
Staff member
Will get you one asap. I also think we should rename the tooled gremlins to remove the " (tool)" from the end and use square bracket disambiguation for them. Is that already present for monsters as it is for items and skills?
Yes, we can disambiguate monster with the same name via monster ID in square brackets now, But we have other examples of monsters where we disambiguate by changing the name. For example:

Code:
Ninja Snowman (Chopsticks)	338	ninjarice.gif
Ninja Snowman (Hilt)	137	snowman.gif
Ninja Snowman (Mask)	100	snowman.gif
Orcish Frat Boy (Music Lover)	62	fratboy.gif
Orcish Frat Boy (Paddler)	63	fratboy.gif
Orcish Frat Boy (Pledge)	64	fratskirt.gif
Just as with the gremlins, each of the above has different item drops and may or may not have the same image. We used to disambiguate the frat boys via intro text when you encounter them, but were not able to disambiguate the snowmen, so we used to have a pseudo-monster "Ninja Snowman (Hilt/Mask)".

I am content to leave the tool gremlins with distinguishable names.

I tried to reproduce that this morning with the frat calculate the universe and the two tentacle fights but wasn't able to. Looking at the code if the MONSTERID_PATTERN matcher fails, it will always return The Darkness unless it's the wumpus, so maybe it would be worth updating the code for the moment to save a debug log of the combat page text if the darkness image isn't found as well? It's possible there could be kol bugs since it's a new feature, or maybe it's just something trivial like white space being different in the html comment.
Good idea. Revision 20166 will put the responseText into the DEBUG log (opening and closing it, if necessary) if there is no MONSTERID and also no darkness.gif
 

Veracity

Developer
Staff member
Looking at monsters.txt:

Code:
ancient protector spirit	0	protspirit.gif	HP: 80 Def: 145 Atk: 158 Init: 10 Phys: 100 P: undead GHOST
# --- ancient protector spirits are distinguishable only by location/drop
ancient protector spirit (The Hidden Apartment Building)	442	protspirit.gif	HP: 80 Def: 145 Atk: 158 Init: 10 Phys: 100 P: undead GHOST Manuel: "ancient protector spirit"	moss-covered stone sphere (c100)
ancient protector spirit (The Hidden Hospital)	443	protspirit.gif	HP: 80 Def: 142 Atk: 162 Init: 10 Phys: 100 P: undead GHOST Manuel: "ancient protector spirit"	dripping stone sphere (c100)
ancient protector spirit (The Hidden Office Building)	444	protspirit.gif	HP: 80 Def: 140 Atk: 160 Init: 10 Phys: 100 P: undead GHOST Manuel: "ancient protector spirit"	crackling stone sphere (c100)
ancient protector spirit (The Hidden Bowling Alley)	445	protspirit.gif	HP: 80 Def: 144 Atk: 156 Init: 10 Phys: 100 P: undead GHOST Manuel: "ancient protector spirit"	scorched stone sphere (c100)
ancient protector spirit (obsolete)	446	protspirit.gif	HP: 80 Def: 144 Atk: 160 Init: 10 Phys: 100 P: undead GHOST Manuel: "ancient protector spirit" Wiki: "ancient protector spirit"	obsidian dagger (c100)
# ---
Do we still need the "ancient protector spirit" pseudo-monster? That is what you used to get when we looked up monsters by name, but now we are looking them up by monster ID.

Code:
Ed the Undying	473	ed.gif,ed2.gif,ed3.gif,ed4.gif,ed5.gif,ed6.gif,ed7.gif	NOCOPY Atk: 180 Def: 162 HP: 1 Init: -10000 P: undead
Ed the Undying (1)	0	ed.gif	BOSS NOMANUEL HP: 256 Def: 162 Atk: 180 Exp: [75+ML/3] Init: 10000 P: undead
Ed the Undying (2)	0	ed2.gif	BOSS NOMANUEL HP: 256 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (3)	0	ed3.gif	BOSS NOMANUEL HP: 128 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (4)	0	ed4.gif	BOSS NOMANUEL HP: 64 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (5)	0	ed5.gif	BOSS NOMANUEL HP: 32 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (6)	0	ed6.gif	BOSS NOMANUEL HP: 16 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (7)	0	ed7.gif	BOSS NOMANUEL HP: 8 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead	Holy MacGuffin (n100)
We disambiguate monster ID #473 to one of the 7 Eds via consequences.txt

Code:
the darkness (blind)	0	darkness.gif	NOMANUEL
We return this for anything with no MONSTERID. We used to do it via consequences.txt

Code:
X-32-F Combat Training Snowman	0	xxx.gif	NOWANDER Atk: 1 Def: 1 HP: 1 E: cold P: construct
Look what my session log says!

Code:
*** Monster 'the X-32-F Combat Training Snowman' has monsterId = 1858
Here is current MONSTER section of consequences.txt:

Code:
# Monster disambiguation:

# Monster ID -94
MONSTER	pooltergeist	poolter2\.gif	"pooltergeist (ultra-rare)"

MONSTER	Ed the Undying	/ed(\d)\.gif	"Ed the Undying ($1)"
MONSTER	Ed the Undying	.	"Ed the Undying (1)"

@ Monster ID -89, -88, -87, -86, -85, -84
MONSTER	Count Drunkula	drunkula_hm\.gif	"Count Drunkula (Hard Mode)"
MONSTER	Falls-From-Sky	fallsfromsky_hm\.gif	"Falls-From-Sky (Hard Mode)"
MONSTER	Great Wolf of the Air	wolfoftheair_hm\.gif	"Great Wolf of the Air (Hard Mode)"
MONSTER	Mayor Ghost	mayorghost_hm\.gif	"Mayor Ghost (Hard Mode)"
MONSTER	The Unkillable Skeleton	ukskeleton_hm\.gif	"The Unkillable Skeleton (Hard Mode)"
MONSTER	Zombie Homeowners' Association	zombiehoa_hm\.gif	"Zombie Homeowners' Association (Hard Mode)"
I will be curious to learn if the Hard Mode Dreadsylvania bosses are really distinct monsters. I bet they are.
 

Rinn

Developer
Someone got a debug log on discord. I'm speculating but it seems likely the the monster was parsed correctly but then overridden with the darkness because the "You twiddle your thumbs." result doesn't have MONSTERID comment.
Code:
[131] God Lobster
Encounter: the God Lobster
Round 0: busta_rhymes     loses initiative!
Round 1: You lose 40 hit points
nextAdventure =>     Noob Cave


[131] Noob Cave
Encounter: the God Lobster
MONSTERID     not found
Round 0: busta_rhymes loses initiative!
[INFO]     - auto_combatHandler: 0
Round 1: busta_rhymes casts SING ALONG!
Round     2: the darkness (blind) takes 1 damage.

Code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        KoLmafia v20.4 r20167, Windows 10, Java 1.8.0_251
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread of KoL's
 Gameplay-Discussion forum. If you would like the KoLmafia dev team
 to look at it, please write a bug report at kolmafia.us. Include
 specific information about what you were doing when you made this
 and include this log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Thu Jun 11 15:25:58 PDT 2020
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=




MONSTERID not found
MONSTERID not found
<html><head>
<script language=Javascript>
<!--
if (parent.frames.length == 0) location.href="game.php";
//-->
</script>
<script language=Javascript src="https://s3.amazonaws.com/images.kingdomofloathing.com/scripts/keybinds.min.2.js"></script>
<script language=Javascript src="https://s3.amazonaws.com/images.kingdomofloathing.com/scripts/window.20111231.js"></script>
<script language=Javascript src="https://s3.amazonaws.com/images.kingdomofloathing.com/scripts/jquery-1.3.1.min.js"></script>
<script language="javascript" src="https://s3.amazonaws.com/images.kingdomofloathing.com/scripts/core.js"></script><script language="javascript" src="https://s3.amazonaws.com/images.kingdomofloathing.com/scripts/ocrs.20200128.js"></script><link rel="stylesheet" href="https://s3.amazonaws.com/images.kingdomofloathing.com/scripts/ocrs.css" /><script src="https://s3.amazonaws.com/images.kingdomofloathing.com/scripts/fight.js"></script>
<script>
var onturn = 1;


</script>    <link rel="stylesheet" type="text/css" href="https://s3.amazonaws.com/images.kingdomofloathing.com/styles.20151006.css">
<style type='text/css'>
.faded {
    zoom: 1;
    filter: alpha(opacity=35);
    opacity: 0.35;
    -khtml-opacity: 0.35; 
    -moz-opacity: 0.35;
}
</style>


</head>


<body>
<center><table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Combat!</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'  crossorigin="anonymous"  src="/iii/adventureimages/godlob.gif?a=1591914358" width=400 height=300><img  crossorigin="anonymous"  src="https://s3.amazonaws.com/images.kingdomofloathing.com/otherimages/powerpixels/eyes9.png" style="position: absolute; top: 100px; left: 170px" id='peyes' /></div></td><td valign=center></td><td width=30></td><td><table><tr><td width=30><img src=https://s3.amazonaws.com/images.kingdomofloathing.com/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>445</font></b></td><td><img src=https://s3.amazonaws.com/images.kingdomofloathing.com/itemimages/skull.gif alt="This monster is a Horror" title="This monster is a Horror"></td></tr><tr><td width=30><img src=https://s3.amazonaws.com/images.kingdomofloathing.com/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>127</font></b></td><td><img src=https://s3.amazonaws.com/images.kingdomofloathing.com/itemimages/circle.gif width=30 height=30 alt="This monster has no particular elemental alignment." title="This monster has no particular elemental alignment."></td></tr><tr><td width=30><img src=https://s3.amazonaws.com/images.kingdomofloathing.com/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>95</font></b></td><td><img src=https://s3.amazonaws.com/images.kingdomofloathing.com/itemimages/watch.gif alt="Initiative +1000%" title="Initiative +1000%"></td></tr></table></td></tr></table><br><script type="text/javascript">var monsterstats = {"hp":"95","def":"127","off":"445"};</script>You're fighting <span id='monname'>the God Lobster</span><p><script>var ocrs = ["powerPixel"];</script>You twiddle your thumbs.<table><tr><Td></td></tr></table><p><center><table><a name="end"></a><tr><td><center><Table cellpadding=10 cellspacing=0><Tr><td></td><td valign=top></td><td valign=top><form name=mariosk7334 action=fight.php?method=post><input type=hidden name=action value=skill><input type=hidden name=whichskill value=7334><input type=submit class=button onclick="return killforms(this);" value="Jump Attack"></form><form name=mariosk7336 action=fight.php?method=post><input type=hidden name=action value=skill><input type=hidden name=whichskill value=7336><input type=submit class=button onclick="return killforms(this);" value="Multi-Bounce (2PP)"></form></td></tr></table></center></td></tr><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=abs1 value=8708>abstraction: action (1)</option><option picurl=abs3 selected value=8710>abstraction: sensation (1)</option><option picurl=cast value=474>cast (1)</option><option picurl=bic value=7220>cigarette lighter (1)</option><option picurl=crayonshavings value=5703>crayon shavings (4)</option><option picurl=grenade value=5750>CSA obedience grenade (1)</option><option picurl=disease value=452>disease (1)</option><option picurl=divstring value=3119>divine can of silly string (2)</option><option picurl=divpopper value=3121>divine champagne popper (1)</option><option picurl=divnoise value=3118>divine noisemaker (1)</option><option picurl=syringe2 value=6026>Duskwalker syringe (1)</option><option picurl=electronicskit value=9952>electronics kit (3)</option><option picurl=kgbcigar value=9497>exploding cigar (6)</option><option picurl=gascan value=9947>gas can (1)</option><option picurl=deadbootlet value=9968>jam band bootleg (2)</option><option picurl=mario_mushroom1 value=10455>mushroom (5)</option><option picurl=web value=27>spider web (1)</option><option picurl=tinydress value=9963>very small red dress (2)</option><option picurl=potion5 value=469>wussiness potion (2)</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="15" picurl="commacha" >CLEESH (10 Mojo Points)</option><option value="7336" picurl="mario_multibounce" selected>Multi-Bounce (2 PP)</option><option value="7334" picurl="mario_jump" >Jump Attack (0 Mojo Points)</option><option value="7327" picurl="shrinkenemy" >CHEAT CODE: Shrink Enemy (5 of today's remaining 20%)</option><option value="7326" picurl="replaceenemy" >CHEAT CODE: Replace Enemy (10 of today's remaining 20%)</option><option value="7311" picurl="may4sword" >Use the Force, Busta_Rhymes! (5 uses left)</option><option value="7310" picurl="bat" >Become a Bat (10 time(s) remaining today))</option><option value="7309" picurl="puff" >Become a Cloud of Mist (10 time(s) remaining today))</option><option value="7308" picurl="wolfmask" >Become a Wolf (10 time(s) remaining today))</option><option value="7303" picurl="lattecup4" >Gulp Latte (0 Mojo Points)</option><option value="7301" picurl="lattecup3" >Throw Latte on Opponent (0 Mojo Points)</option><option value="7297" picurl="songboombox" >Sing Along (0 Mojo Points)</option></select> <input class=button type=submit onclick="return killforms(this);" value="Use Skill"></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></td></tr></table></center></td></tr><tr><td height=4></td></tr></table></center></body></html>
 
Last edited:

Veracity

Developer
Staff member
How did they do that?

They started a combat.
- It was round 0 and KoL included the MONSTERID comment
- They lost initiative, so took damage in round 1
(They tried to adventure in the Noob Cave?)
- Kol redirected back to the fight, but it was not round 0 and KoL did not include the MONSTERID - and we got the thumb twiddling.
- we did log the encounter, but thought it was round 0 again - even though the monster had already gone in round 0
- The player did an action was recorded for round 1.

Perhaps KoL could/should include the monsterId every round.
(What happens if I CLEESH? do we get a new MONSTERID?)

Perhaps we could/should redirecting into a fight-in-progress and carry on without it being a new encounter.
(What happens if I log out while in a fight and log in again? it redirects to fight.php. Does it give me a new MONSTERID?)
In other words, anything which results in thumb twiddling is not a new encounter at round 0. IIt is at whatever round KoL thinks it is.

I'll experiment with those things, but I think my suggestion is for KoL to give a MONSTERID every time it redirects to fight.php and gives a response page for a fight.

And maybe if there is no MONSTERID, we should go through the same stuff - parse out the random modifiers, etc. - and try looking up the monster by name.
 

Veracity

Developer
Staff member
I put on dice gear and Helps-You-Sleep.

Code:
[9848] The Goatlet
Encounter: bouncing, askew, pixellated, hot, cloud-based drunk goat
That was what KoL told me I had. no MONSTERID. Image of "the darkness".

Code:
> ash last_monster()

Returned: the darkness (blind)
No random modifiers.

I clearly need to parse random modifiers, etc. even before checking for no MONSTERID.
 

Rinn

Developer
They were running autoscend, I'm not sure specifically what the script is doing but I wouldn't be surprised if it's doing something weird. Regardless I agree, getting the monsterid in every round is probably the way to go.
 

Rinn

Developer
Just tested logging in while in a fight, the page doesn't have MONSTERID so yeah same issue being unable to determine the monster.

I also tested CLEESH, it works correctly to update the monster, as does macrometorite.
 

Veracity

Developer
Staff member
Well, I would encourage KoL to include MONSTERID every single round.
I will also consider having KoLmafia use (a variant) of the old algorithm, when there is no MONSTERID, to try to figure out the monster from the monster name. I do NOT want to put in the kludges to deal with DMT monsters, monster synonyms in LLT zones, etc.
I will also consider recognize that "you twiddle your thumbs" is continuing an existing fight and reusing the previous encounter, pulling the round number from KoL, etc.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Another thing this raises is that we should possibly do something to bring better support for "indirect" combat in ash. At the moment people tend to get to a position wherein they "know" they will be in a combat, and then trigger combat stuff by adventuring in Noob Cave, even though that isn't the real adventure. I'm not really sure why people don't use run_combat() or something, perhaps a script author can tell me why.
 

Crowther

Active member
I'm not really sure why people don't use run_combat() or something, perhaps a script author can tell me why.
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.
 

zarqon

Well-known member
At the moment people tend to get to a position wherein they "know" they will be in a combat, and then trigger combat stuff by adventuring in Noob Cave, even though that isn't the real adventure.

Interesting. This is the first I've heard of that. I've used run_combat() for ages for that purpose. I even have an alias fight => ashq run_combat(); which has served me quite well over the years.
 

Veracity

Developer
Staff member
At the moment people tend to get to a position wherein they "know" they will be in a combat, and then trigger combat stuff by adventuring in Noob Cave, even though that isn't the real adventure. I'm not really sure why people don't use run_combat() or something, perhaps a script author can tell me why.
I would consider that to be a bug in the script.

One rationale might be tht they don't know if they are at a combat or a choice and therefore don't know whether to use run_combat() or run_choice(). Using "adventure" will force a redirect to either fight.php or choice.php and KoLmafia will automate it. How do "people" start an adventure such that they "know" they are in combat? If via visit_url, they have the page text. They also have handling_choice().

The example above was fighting the god lobster and then going to the Noob cave to do the fight. I can't understand why it was coded that way. My script to do god lobster fights uses visit_url, run_combat, and run_choice.

Code:
    while ( fights > 0 && my_adventures() > 0 ) {
	// Choose which item to equip
	int scepters = available_amount( GOD_LOBSTER_SCEPTER );
	int rings = available_amount( GOD_LOBSTER_RING );
	int rods = available_amount( GOD_LOBSTER_ROD );
	int robes = available_amount( GOD_LOBSTER_ROBE );
	int crowns = available_amount( GOD_LOBSTER_CROWN );
	item familiar_item =
	    ( crowns > 0 ) ? GOD_LOBSTER_CROWN :
	    ( robes > 0 ) ? GOD_LOBSTER_ROBE :
	    ( rods > 0 ) ? GOD_LOBSTER_ROD :
	    ( rings > 0 ) ? GOD_LOBSTER_RING :
	    ( scepters > 0 ) ? GOD_LOBSTER_SCEPTER :
	    NO_ITEM;
    
	// If unspecified, use whatever the familiar is already wearing
	if ( familiar_item != NO_ITEM ) {
	    equip( familiar_item );
	}

	between_battle_checks();
	string page = visit_url( "main.php?fightgodlobster=1" );
	if ( !page.contains_text( "fight.php" ) ) {
	    // Unexpected
	    break;
	}

	combat_filter_setup( NO_LOCATION );
	page = run_combat( "default_filter" );
	fights--;

	if ( !page.contains_text( "choice.php" ) ) {
	    // Unexpected. Perhaps you lost the fight?
	    continue;
	}

	page = visit_url( "choice.php" );

	// Options 1, 2, or 3 - unless you are wearing the crown, in
	// which case the "regalia" option is not available and the
	// others are 1 and 2. We'll go for "experience"
	// 
	// "I'd like part of your regalia."
	// "I'd like a blessing."
	// "I'd like some experience."

	int option = ( familiar_item == GOD_LOBSTER_CROWN ) ? 2 : 1;
	run_choice( option );
    }
 
Top