Feature Supporting Combat Macros in CCS

StDoodle

Minion
When you say "aborting to a CCS", you mean that the consult script simply ends? An abort() would stop Mafia.

Actually, I have no idea what abort() does from inside a consult script... never tried it (barely used them, actually; mostly just testing for wiki fact-checking).

As for the rest; that's pretty much what I was thinking, but then again, I prefer to sit back and wait to see what the devs come up with, first. ;)
 

jasonharper

Developer
At the moment, mafia isn't overriding autoattack macros (I'm not sure why), so you can set one as your autoattack and then use any form of mafia automation.

Also, adv1() and the 3-parameter form of adventure() have an undocumented feature - the last parameter can be the text of a macro, which completely replaces normal combat automation. This is distinguished from the normal use of that parameter as a function name by the presence of a semicolon in the string. This doesn't work quite right at the moment, due to a server-side problem: the first command in your macro gets logged, but doesn't actually get performed. You can work around that by including a dummy "attack" command at the start, but note that it may cease to be a dummy at any moment due to the problem being fixed! It is also not well-defined at the moment just what happens if your macro aborts, or fails to finish the combat.
 

Stardock

Member
I realize that eventually kolmafia should convert a CCS into a macro where possible, but there's still issues server-side for that. Do you think it would be possible to make a special CCS command to call a macro by name in the meantime, or is it too much work?
 

jasonharper

Developer
A "macro" CCS command would be possible, but may cause problems once mafia starts converting CCS to macro form, since it can't readily access the text of the macro. The combat would have to be split up into multiple pageloads (CCS before macro / call to macro itself / CCS after macro), thus losing much of the benefit from converting to macros in the first place. The situation will be different if the macro language ever gains the ability to invoke another macro, in which case mafia could simply use that as the translation of the "macro" command.
 

xKiv

Active member
The combat would have to be split up into multiple pageloads (CCS before macro / call to macro itself / CCS after macro), thus losing much of the benefit from converting to macros in the first place.

I think mafia will have to do that (or something similar) for CCS that includes a consult script anyway. Or simply only translate CCS->macro in the anti-presence of non-transatable elements.
 

Stardock

Member
That's actually a good point. I think there's definitely an appeal for the macro command in consult scripts.

Ideally you could probably make use of a lot of features that mafia has that kol doesn't.

Off the top of my head, being able to choose which macro you use based on your class, currently equipped familiar or gear, how many of each item you have, how much hp the monster has, etc.

Most of these things are either low priority or probably not going to happen within the kol macro framework.
 
You have said that consult scripts aren't really convertable into macros. So I have written to macros to emulate the consult scripts I usually use.
So my question is how do I call my macros directly from mafia. Ideally I'd just like to have a CCS script that looks like this:

[default]
0: macro name_of_macro

But maybe some other idea to make this happen is appropriate, for example the Action pulldown menu could have "macro"
and then you would specify the name of the macro somewhere else, if you think this would conflict with your CCS to macro
conversion ideas.

However, I *would* like a way to directly run my own macros, so I can continue to have my consult script functionality with
only 1 server hit.
 

StDoodle

Minion
You may want to look here and here for the current discussions of this topic. Suffice to say, as of RIGHT NOW the only way to call combat macros while scripting with full ash control is to use the ash commands adventure() or adv1() with a third, special parameter (details in linked thread).
 

Spiny

Member
At present, if you set your kol macro as your auto-attack within kol, you can automate adventures thru mafia using that macro regardless of what your mafia settings are set at. You will, however, have to be wary when you don't want to use that auto-attack macro, you'll have to disable it yourself. Ie I have RT's hobomonkey.balls as a kol macro since consult scripts aren't recognized as macros. I forgot I had it set as my autoattack the following day and burned 10 turns using the facsimile dictionary and a llama while bounty hunting. Finally mafia aborted when the bounty item didn't drop due to fumbling I presume which made the combat last too long.
 

Bale

Minion
Also, adv1() and the 3-parameter form of adventure() have an undocumented feature - the last parameter can be the text of a macro, which completely replaces normal combat automation. This is distinguished from the normal use of that parameter as a function name by the presence of a semicolon in the string.

I have a question: Macros do not normally contain semicolons. Does this mean we are expected to use semicolons to separate lines instead of \n if we use this feature?
 

jasonharper

Developer
Well, yes - given that it's generally easier to put a semicolon than a newline in an ASH string constant, I expected people to do things the easy way. If you really want to use newlines, stick a semicolon on the end, or something like that.
 

Bale

Minion
Thanks. That wasn't obvious to me since semicolons aren't used in macros. It's definitely easier.
 

jasonharper

Developer
Semicolons certainly can be used in macros, with exactly the same meaning as a line break; there isn't any special handling of semicolons going on here, your macro is passed on to KoL unchanged.
 

StDoodle

Minion
So, apparently, this is easier than I'd thought. For example, I just beat up some fluffy bunnies using the following as a consult script (I'm not posting details about using a consult script in a CCS, we know how to do that already).

Code:
string macro() {
    return "skill entangling noodles\nskill saucestorm";
}

void main(int round, monster mob, string combat) {
    visit_url("fight.php?action=macro&macrotext=" + macro());
}

Obviously, this isn't useful as written; you'd want macro() to create something a bit... less basic. But the idea should be helpful, I hope. And I can't tell for sure, but at worst, it uses 1 more server hit per combat than a "normal" CCS would. Of course, things have more potential for bad borkage if your script is bad, but hey....
 
Top