I can't get my combat filter to work. I've copied an example almost verbatim from http://wiki.kolmafia.us/index.php?title=Adventure
I set my ccs to contain just "abort", in order to test the following snippet. What I expect to happen is for run_combat to use the filter. The combat filter should initially return "skill CLEESH". I'm running this after starting a combat with a non-cleeshed opponent. The filter does indeed appear to be detecting this & returning "skill CLEESH". But I'm not CLEESHing.... Instead, Mafia appears to be ignoring the return value, and consulting my ccs directly. (I think. It's not getting the contents through whm_combat_cleesh, at least. I can do some more investigation on my end.)
How can I get this to work? Is there something I'm missing?
I set my ccs to contain just "abort", in order to test the following snippet. What I expect to happen is for run_combat to use the filter. The combat filter should initially return "skill CLEESH". I'm running this after starting a combat with a non-cleeshed opponent. The filter does indeed appear to be detecting this & returning "skill CLEESH". But I'm not CLEESHing.... Instead, Mafia appears to be ignoring the return value, and consulting my ccs directly. (I think. It's not getting the contents through whm_combat_cleesh, at least. I can do some more investigation on my end.)
How can I get this to work? Is there something I'm missing?
Code:
string whm_combat_cleesh(int actionIndex, string opp, string text) {
print("whm_combat_cleesh", "(" + actionIndex + "," + opp + ",...)");
if (
opp == $monster[frog].to_string() || opp == $monster[newt].to_string()
|| opp == $monster[salamander].to_string()
) {
// (not sure if this is right. at the moment, it doesn't ever get executed.)
print("returning '" + get_ccs_action(actionIndex) + "'");
return get_ccs_action(actionIndex);
}
print("returning 'skill CLEESH'");
return "skill CLEESH";
}
void whm_test() {
buffer combatResult = run_combat("whm_combat_cleesh");
print("okay, run_combat(\"whm_combat_cleesh\") returned. buffer has length " + length(to_string(combatResult)));
print_html(combatResult);
}