kludged-together combat consult script

kain

Member
--disclaimer-- I wrote very little of the original code for this --disclaimer--

So I've been using FTF and SmartStasis for a while now. But I've got multiple chars who have different equipment and skill sets and it's been bothersome to try and modify their individual ccs settings on the fly as needed.

So I've adapted a combat consult script that I've had for a long long time called casualcombat.ash. I can't for the life of me remember who wrote it, nor can I find any reference to it on the forums. If this is yours, thanks, and speak up!

It's not all-encompassing, nor does it work 100% right all the time (sometimes it hangs at the end of combat). I haven't tested the plink portion, either.

It prefers to shieldbutt, followed by LTS if you're a seal clubber, else it throws some spells or attacks if you're able to hit the monster. Obviously, if you don't have the skills referenced by the script and can't hit automatically, it's not going to work for you.

But it works "well enough" for me right now. I'm putting it up in the hopes that it can be improved upon, tweaked and polished. Or so that someone with a far more-better script will laugh heartily at me (and share)

It's designed to work (IE, I tried to remove all the duplicate functionality) with FTF/SS so it's not going to noodle or anything like that.

My CCS looks like so:
[ default ]
1: consult smartstasis.ash
2: consult casualcombat.ash
 

Attachments

  • casualcombat.ash
    15.1 KB · Views: 165

mredge73

Member
are you still working on this script?

I attached a few edits, not much but it has fixed a few problems that I have encountered
 

Attachments

  • casualcombat.ash
    16.2 KB · Views: 102

mredge73

Member
it really really needs a rewrite,

I could make an attempt but I would need the community support since not everyone plays like I do since my main strategy for everything is to attack with weapon unless I am a myst class. A combat script ccs would be a good project for the entire scripting community to get involved in. Kain did a good job collecting from many different scripts and putting them in one but it is definitly kludged-together.
 

Bale

Minion
Looking at it now. My first project: Make the formatting consistent and improve clarity so that I can work with it.
 

Bale

Minion
My first improvement: second_plinkitem didn't always work. Fixed it:

Code:
item second_plinkitem(monster opponent, item firstplink) {
	boolean check_second(item it) {
		return (item_amount(it) - to_int(firstplink == it) > 0);
	}
	
	switch {
	case check_second($item[Miniborg Destroy-O-Bot]):
		return $item[Miniborg Destroy-O-Bot];
	case check_second($item[toy merc]):
		return $item[toy merc];
	case check_second($item[spectre scepter]):
		return $item[spectre scepter];
	case check_second($item[spices]):
		return $item[spices];
	case check_second($item[seal tooth]):
		return $item[seal tooth];
	case check_second($item[turtle totem]):
		return $item[turtle totem];
	}
	return $item[none];
}

Attached my local version of casualcombat.ash below. This mostly includes a number of legibility changes.
 

Attachments

  • casualcombat.ash
    15.7 KB · Views: 93
Last edited:

halfvoid

Member
while using this in a softcore run it became apparent that i could have just been attacking with my weapon and still would have one hit killed most of the enemies i was fighting.

it became apparent as my meat was rapidly disappearing to refill my MP.

is there a way to put that "fallback strategy" in the beginning to avoid the waste of MP on skills that don't need to be used?
 

halfvoid

Member
oh. after looking at the script its allready in there unless you added it bale.

its around lines 321 - 332.
 

Bale

Minion
Turned 4 clunky functions into 2 tidy functions

Code:
item unknown_sphere() {
	string [item] sphere_list;
		sphere_list[$item[mossy stone sphere]]   = "lastStoneSphere2174";
		sphere_list[$item[smooth stone sphere]]  = "lastStoneSphere2175";
		sphere_list[$item[cracked stone sphere]] = "lastStoneSphere2176";
		sphere_list[$item[rough stone sphere]]   = "lastStoneSphere2177";
	foreach sphere, prop in sphere_list
		if(get_property(prop) == "" && item_amount(sphere) > 0)
			return sphere;
	return $item[none];
}

// Returns an unknown bang potion to identify if you have an extra
item unknown_bang_potion() {
	string [item] bang_list;
	for i from 819 to 827
		bang_list[to_item(i)] = "lastBangPotion" + to_string(i);
	foreach potion, prop in bang_list
		if(get_property(prop) == "" && item_amount(potion) > 1)
			return potion;
	return $item[none];
}
 

Attachments

  • casualcombat.ash
    13.3 KB · Views: 93
Last edited:

Bale

Minion
Made some more fixes to better support funkslinging with potion identification.

This script sucks. combat() need a serious rewrite. It needs to be pulled apart and rebuilt. I'm not up for that yet...

Edit: Attachment is removed because it won't work. Bug is fixed in my next post.
 
Last edited:

halfvoid

Member
This occurred with a sauceror without funkslinging. I'm guessing it was trying to toss two items or something.

Code:
[68] Giant's Castle
Encounter: Goth Giant
Strategy: C:\Documents and Settings\halfvoid\My Documents\kolmafia\ccs\default.ccs [default]
Round 0: vaelith wins initiative!
Round 1: vaelith casts SAUCY SALVE!
You gain 15 hit points
Casual Combat, revamped.
opponent : Goth Giant
monster att/def : 141/141
Array index out of bounds (casualcombat.ash, line 109)
You're on your own, partner.
 

kain

Member
Oh wow.

I haven't been working on this at all recently. Yes, the layout, etc sucks (it's still mostly formatted from the original script writer) and it is/was a bit buggy.

Pretty much my only contribution was to make it work at the time. (not well, just work period)
 

Bale

Minion
I agree with mredge73 that it might be fun for the community here to work on this together, contributing what they can. I'm going to try working with it from time to time, but the real problem is the main function. That needs to be completely pulled apart and have some of it's parts put into other functions for the sake of comprehension and rewritability.
 

halfvoid

Member
i'm of no use with maps. i've tryed looking through it to see what i'd change and all i can really think of is adding more skills to the big bad section, or making a regular attack more of a priority to use to save MP in ronin.
 

Rinn

Developer
Here's the basics to add support for spring raindrop attack, I have mine in a completely different script that occurs in my css after ftf but before I start killing things, but the concept is the same:

Code:
string use_spring_raindrop_attack(string url)
{
    if (my_mp() == my_maxmp())
        return url;
    
    if (equipped_item($slot[weapon]) == $item[haiku katana] && url.contains_text(">Spring Raindrop Attack"))
    {
        url = use_skill($skill[Spring Raindrop Attack]);

        if (my_mp() == my_maxmp())
            return url;
    }

    if (url.contains_text(">Consume Burrowgrub"))
    {
        url = use_skill($skill[Consume Burrowgrub]);

        if (my_mp() == my_maxmp())
            return url;
    }

    if (equipped_item($slot[off-hand]) == $item[haiku katana] && url.contains_text(">Spring Raindrop Attack"))
        url = use_skill($skill[Spring Raindrop Attack]);

    return url;
}

void main(int round, string foe, string url)
{
    url = use_spring_raindrop_attack(url);
}

Same kind of thing for mayfly bait:

Code:
string use_summon_mayfly_swarm(string page)
{
    if (have_equipped($item[mayfly bait necklace]) && page.contains_text(">Summon Mayfly Swarm"))
        page = use_skill($skill[Summon Mayfly Swarm]);

    return page;
}

void main(int round, string foe, string url)
{
    url = use_summon_mayfly_swarm(url);
}

Checking the page source for ">skill" is a good way to check if you can currently cast something.
 
Last edited:

Bale

Minion
Included Rinn's suggestions for spring raindrop, summon burrowgrove & mayfly bait.

Gave the main loop a thorough rewrite to clean up a couple of bugs and drastically improve clarity. It's still awful, but now it is comprehensible so that it is obvious how to fix it or add new combat options. I'm not sure if I'll rewrite it into something more in line with good combat practices since it is now understandable.

I find it amusing how the file is still getting smaller. :p

halfvoid, please continue to give feedback on what works and what doesn't work.
 

Attachments

  • casualcombat.ash
    13 KB · Views: 49

halfvoid

Member
will do sir. I've been adding moxious manuever for my main since he's only been a disco bandit thus far and has none of the skills in the script.
 

Bale

Minion
Well, you won't ever have to add moxious maneuver again. I just added it. Though I'm not sure it was added optimally. Ideas?

Enjoy.
 

Attachments

  • casualcombat.ash
    13.1 KB · Views: 63
Top