Quick question on Custom Combat

Story

New member
Hey all! I have what is probably the stupidest question ever....

I've been using mafia for quite a while, but I know absolutely nothing about scripting. I've tried to find the answer in the forums, but I don't understand about 97.5% of what I'm reading. I managed to set up & use some simple combat scripts, but my question is, can I use "if" in a CCS? I want mafia to automatically siphon my happy medium when the aura turns red, so would something like this work? I should add, I found this in the KoL forums "macros" thread.

if happymediumglow red skill siphon spirit
skill entangling noodles
skill candyblast
skill candyblast
skill ravioli shurikens
attack with weapon

Any help would be HUGELY appreciated.

Story
 

Winterbay

Active member
That would work just fine with a small modification:
Code:
if happymediumglow red
skill siphon spirit
endif
skill entangling noodles
skill candyblast
skill candyblast
skill ravioli shurikens
attack with weapon
 

Story

New member
Wow, that WAS a simple fix! I can't wait to try it out tomorrow. I've been just using 2-3 adventures at a time until the familiar icon shows the orange aura picture, then adventuring manually until it turns red. Thank you!
 

Raven434

Member
In a similar vein, why does this abort after every combat?

I just want it to abort when the glow is blue and kill everything else until I get there:

[ default ]
try to steal an item
if happymediumglow blue
abort after this combat
endif
attack with weapon

Thanks!
 

EdFox

Member
Why does this not work?
Code:
if happymediumglow red 
skill siphon spirit 
endif
consult WHAM.ash

It will use siphon spirit every combat, regardless of the glow. I'm sure I'm missing something basic. :confused: Help much appreciated.
 

jasonharper

Developer
Using "consult" prevents macrofication of your CCS, and the "if"/"endif" commands you're using exist only in KoL's combat macro language - they're simply ignored, otherwise.
 

EdFox

Member
Ah, so it's a case of getting one or the other but not both. Thanks. Now to beg Winterbay to incorporate this into WHAM.
 

Bale

Minion
I believe it will work if you add a few quotes. Like this:

Code:
"if happymediumglow red"
skill siphon spirit 
"endif"
consult WHAM.ash

That will tell mafia to do exactly what you said, without trying to interpret it.
 

Winterbay

Active member
Yeah, I think I'll add that to WHAM as well. Shouldn't be too hard since there is already a global override string that can get built on. Probably use a setting that specifies the colour you want to siphon.
 

chown

Member
I wrote a consult script a while ago that apparently works around a Mafia limitation where macros and consult scripts couldn't be used in the same CCS. Here's the consult script:
Code:
void main(int actionIndex, monster opponent, string pageText) {
        //print("Macroifying from actionIndex " + actionIndex);
        string macro;
        for i from actionIndex to 100 {
                if (get_ccs_action(i) == "consult whm_consultMacro.ash") {
                        //print("found consult entry at actionIndex " + i);
                        macro = get_ccs_action(i+1);
                        if (macro.substring(0,1) == "\"" && macro.substring(length(macro)-1,length(macro)) == "\"") {
                                macro = macro.substring(1, length(macro)-1);
                        }
                        //print("macro to use is '" + macro + "'");
                        break;
                }
        }
        visit_url("fight.php?action=macro&macrotext=" + url_encode(macro), true, true);
}

Apparently, that's still a thing, and the script seems to be working for me, so maybe it's useful for other folks, too. I use it like so: (The above consult script is whm_consultMacro.ash.)

Code:
[ default ]
try to steal an item
consult whm_consultWatercolors.ash
consult whm_consultMacro.ash
"use Miniborg hiveminder; repeat !match Bjorn && !pastround 15; use Miniborg hiveminder; repeat !match "yellow eye" && !pastround 20"
skill point at your opponent
attack with weapon
attack with weapon
attack with weapon
skill fearful fettucini
skill weapon of the pastalord
abort
 
Top