Bug - Waiting for Info ASH Combat Consult Script fails recognition of new monster through Macrometeorite

Aenimus

Member
Hello,

This is very easy to reproduce:
Code:
void main(int rnd, monster mob, string pg) {
	print("Entering main().");
	print(`"We are fighting a {mob}."`, "red");
	if (use_skill(1, $skill[Macrometeorite])) return;
}

This causes a 1 round delay to realise what is being fought.

This fixes it:
Code:
void main(int rnd, monster mob, string pg) {
	print("Entering main().");
	print(`"We are fighting a {mob}."`, "red");
	if (use_skill(1, $skill[Macrometeorite])) {
		twiddle();
		return;
	}
}

In short: Mafia needs a round to realise the monster has changed, but if you have if conditions for monsters, it will reach that block before it realises the monster has changed with a return alone.

Is there any chance this could be handled?

Thanks!
 
Last edited:

Veracity

Developer
When you transform a monster - CLEESH, or however - KoL gives a new MONSTERID in the response to that action.
You seem to be saying that it does not do so for Macrometeorite. Or, perhaps, it has a nonstandard response.
I could swear that it used to. I could swear I tested it.

I guess I'll test it again and submit a bug report if necessary.
 

Veracity

Developer
Wait.

You using the one-argument form of use_skill - which returns a buffer (the result text of the page) and using the result as the conditional for an if statement?
What is that even supposed to do?
 

Aenimus

Member
I actually have my own wrapper for that, but I quickly translated it (poorly). I updated the code.
 
Last edited:

Veracity

Developer
Code:
void main(int rnd, monster mob, string pg) {
	print("Entering main().");
	print(`"We are fighting a {mob}."`, "red");
	if (use_skill(1, $skill[Macrometeorite])) return;
}
This is a consult script which does one round of combat.

How are you using this?

Mafia needs a round to realise the monster has changed, but if you have if conditions for monsters, it will reach that block before it realises the monster has changed with a return alone.
What are "if conditions for monsters"?

I need to understand the context in which you are using this. Does your real consult script handle more than one round?

What are you doing?
 

Aenimus

Member
My actual consult script is massive; I included a relevant and isolated snippet that replicates the problem.

Whenever I cast Macrometeorite, I want to return so that the consult script gets called again and runs from the beginning.

If I do not twiddle() after casting Macrometeorite and before returning, it still thinks I am fighting the same monster as I was fighting before casting Macrometeorite.

So let's say I use Macrometeorite on a sausage goblin and return immediately. If I have a block that applies to sausage goblin; for example:
Code:
if (mob == $monster[Sausage goblin]) { whatever }
It will enter this block, because for one round, Mafia thinks I am still fighting the sausage goblin. If I give it one round to recuperate after Macrometeorite, such as with twiddle() as shown, it recognises a change in monster.

Does this summary help?
 

Aenimus

Member
This is the output from yesterday illustrating the issue:

Code:
We are fighting a Knob Goblin Barbecue Team.
Round 1: Aenimus casts MACROMETEORITE!
Round 2: your opponent becomes a tumbleweed!
Preference _macrometeoriteUses changed from 5 to 6
Entering main.
We are fighting a Knob Goblin Barbecue Team.
Round 2: Aenimus casts MACROMETEORITE!
Round 3: your opponent becomes a tumbleweed!
Preference _macrometeoriteUses changed from 6 to 7
Entering main.
We are fighting a tumbleweed.
Round 3: Aenimus casts MACROMETEORITE!
Round 4: your opponent becomes a tumbleweed!
Preference _macrometeoriteUses changed from 7 to 8
Entering main.
We are fighting a tumbleweed.
Round 4: Aenimus casts MACROMETEORITE!
Round 5: your opponent becomes a tumbleweed!
Preference _macrometeoriteUses changed from 8 to 9
 
Last edited:

Veracity

Developer
This appears to be a regression in KoL.

As of July 1, 2020, KoL gave MONSTERID both at the top of the page and also later in the page when you did an action that transformed a monster. I have HTML from that date that shows that:

Code:
You're fighting <span id='monname'>an XXX pr0n</span></td><!-- MONSTERID: 138 -->
<!-- MONSTERID: 142 -->You press the correct series of buttons on your glove.  Your enemy flickers out of existence with a hiss of static, and is replaced by something different...
I extracted both of those from the same response to casting CHEAT CODE: Replace Enemy

My SVN commit that handles that.

"Now that MONSTERID appears both at the beggining of the fight page and also later in the
same response if your action transforms the monster, detect when a monster has been transformed
and transform last_monster() immediately."

I did some testing today using CHEAT CODE: Replace Enemy, CLEESH, and Macrometeorite.

Code:
You're fighting <span id='monname'>an XXX pr0n</span></td><!-- MONSTERID: 138 -->
<!-- MONSTERID: 141 -->You press the correct series of buttons on your glove.  Your enemy flickers out of existence with a hiss of static, and is replaced by something different...
Round 2: your opponent becomes a 1335 HaXx0r!

You're fighting <span id='monname'>a 1335 HaXx0r</span></td><!-- MONSTERID: 141 -->
You cast CLEESH at your opponent. He turns into <script>newpic("https://s3.amazonaws.com/images.kingdomofloathing.com/adventureimages/salamander.gif", "a salamander",100,100);</script>a salamander.
Round 2: your opponent becomes a salamander!

You're fighting <span id='monname'>a fishy pirate</span></td><!-- MONSTERID: 1763 -->
<script>newpic("https://s3.amazonaws.com/images.kingdomofloathing.com/adventureimages/stinkpirate1.gif", "a filthy pirate",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.
Round 2: your opponent becomes a filthy pirate!
CHEAT CODE: Replace Enemy works as before, but CLEESH and Macrometeorite no longer give a second MONSTERID.

I'll submit a bug report.
 

Aenimus

Member
I did some digging, because CDM said nothing has changed. I've concluded that you only ever get the second MOSNTERID tag if you have the powerful glove equipped, regardless of whether you're actually using Replace Monster. So Macrometeor and Cleesh will have a second MONSTERID tag in the HTML as long as you have the powerful glove equipped, but they otherwise never will.

Hopefully this will be fixed soon.
 
Last edited:

Veracity

Developer
Thank you!

I had no logs with CLEESH or Macrometeorite alone (no Powerful Glove) from July. As mentioned, we handle the second MONSTERID exactly the way you'd hoped, so if CLEESH and Macrometeorite get fixed to provide a second MONSTERID, KoLmafia should automatically work the way you expect/desire.
 

Aenimus

Member
Veracity: CDMoyer says this has now been fixed!

Also, planting a general thanks for your hard work here, too. Thanks!
 

Veracity

Developer
I tried a Macrometeorite today and it worked. I was going to paste in your note in the G_D thread here and mention this and close this, but I got distracted,

Thanks for your thanks! Life has gotten very complicated, recently, so I am not really doing much here at the moment. Fortunately, young skillful blood has joined us this year and I'm counting on them to Do The Right Thing. :)
 
Top