Bug - Fixed the 3 parameter version of adv1() can fail to use the combat filter function

Malibu Stacey

Active member
I've only seen it happen with adv1 as we only use adv1 in autoscend so adventure() may need to be tested similarly.

If your battleAction property is not set to "custom combat script", calling adv1 will attempt to run a combat using whatever battleAction is set to (which I believe defaults to "attack with weapon"). This seems counter-intuitive to the purpose of specifying a combat filter function or macro using the 3rd parameter.

Code:
string my_combat_filter(int round, monster enemy, string text) {
  return "item seal tooth";
}

set_property("battleAction", "attack with weapon");
adv1($location[The Spooky Forest], -1, my_combat_filter);
set_property("battleAction", "custom combat script");
adv1($location[The Spooky Forest], -1, my_combat_filter);
 

Veracity

Developer
Staff member
Surely you mean

Code:
adv1($location[The Spooky Forest], -1, "my_combat_filter");
since adv1 takes a string which is the name of the function. I adjusted the test to be this:

Code:
string my_combat_filter(int round, monster enemy, string text) {
    print( "in combat filter" );
    return "attack";
}

set_property("battleAction", "attack with weapon");
print("battleAction = " + get_property("battleAction"));
adv1($location[The Spooky Forest], -1, "my_combat_filter");
set_property("battleAction", "custom combat script");
print("battleAction = " + get_property("battleAction"));
adv1($location[The Spooky Forest], -1, "my_combat_filter");
(note that I made the combat filter attack, since I can only test right now with Drunkula's wineclass)
I got this result:

Code:
[color=green]> cftest[/color]

battleAction = attack with weapon

Visit to Woods: The Spooky Forest in progress...

[877604] The Spooky Forest
Encounter: triffid
Round 0: Tebryn wins initiative!
in combat filter
Round 1: Tebryn attacks!
moxie weed is not multiusable, but KoLmafia thought it was
Round 2: triffid takes 10152 damage.
Round 2: Stubert climbs up and sits on your shoulder, and hands you some Meat. Huh, where did he find that?
You gain 71 Meat.
Round 2: Tebryn wins the fight!
After Battle: Wingwang does an impression of a swarm of tiny bees dancing, directing each other to the items they've discovered.
You acquire an item: moxie weed
You acquire an item: spooky stick
After Battle: You gain 3 Magicalness
You acquire an item: Gathered Meat-Clip

battleAction = custom combat script

Visit to Woods: The Spooky Forest in progress...

[877605] The Spooky Forest
Encounter: spooky vampire
Round 0: Tebryn wins initiative!
in combat filter
Round 1: Tebryn attacks!
Round 2: spooky vampire takes 10118 damage.
Round 2: Tebryn wins the fight!
After Battle: Stubert sits on your fallen opponent's body, blows a smoke ring, and winks at you.
You gain 26 Meat
After Battle: Wingwang demonstrates a dance of celebration from his native land. Translated into couscous, it's basically incomprehensible.
After Battle: You gain 3 Mysteriousness

Requests complete.
I see no bug.
 

Malibu Stacey

Active member
My bad reported it wrong. What happens is you get blocked from adventuring with a message "You can't hit anything there." if it's set to "attack with weapon" and your muscle or moxie is deemed too low or something.

Sorry this got reported a while ago & I emergency fixed it by putting the property setting back but it came up again during discussion today so I thought I should report it as it was annoying at the time and will likely come up again.
The user who hit the issue pasted a log here -> https://pastebin.com/JW8MftT4
He's in an Ed run so being able to physically hit stuff is of no consequence (and shouldn't be regardless of path). He's level 8 & being blocked from adventuring in a zone (The Defiled Cranny) he's one level higher than he needs to be to unlock.
 
Top