Autobuffing while ascending

Bloody Knuckles

New member
I'm thinking of writing a script to do the easy quests. Only thing is I don't know how to handle the buffs. I was thinking of making a list of relevant buffs. Then I'd write a function to search for the lowest duration relevant buff, and casting that buff. Repeat until below a certain mana percentage.

Then, I'd call that function after every adventure.

Something like this:

Code:
while(QUEST_NOT_DONE)
{
adventureAt();
foo
}

foo()
{
while( mana/total_mana > 0.3 )
    cast(grabLowestDurationRelevantBuff());
}

grabLowestDurationRelevantBuff()
{
switch (lowestDurationBuff )
    case BuffA
    return BuffA

    case BuffB
    return BuffB

    case BuffC
    return BuffC

    Default 
       throw error;

}

Some questions
How do I grab lowest duration buff? Does it show if the duration is zero? (That is, if I don't have any buffs).

Any help would be appreciated.
 

Fluxxdog

Active member
Code:
> ash have_effect($effect[Disco Fever])

Returned: 1167
have_effect will return an integer based on how many turns you have left. You'll like want to build an array of effects with their remaining turns. IIRC, one method you could do would be to sort a record array.
Code:
record{
   skill b;
   turns t;
} [int] collection;
foreach buff in $skills[Your desired buff skills here, comma separated]{
   int size=collection.count();
   collection[size].b=buff;
   collection[size].t=have_effect(to_effect(buff));
}
sort collection by value.t;
Once sorted, the effect in position 0 will be the one you have the least. You could have it return collection[0].b and have it cast that skill.

What you're doing is creating a record array, filling it with the skills and the turns their effect give, then sorting it by the number of turns of the effect. The very first skill in the collection will be the one you have the least of.

Honestly, I should have done that for my own armor polish. Have fun!
 

Bloody Knuckles

New member
Thanks, you completely answered my question! =)

By the way, do you know how to get an ash to click on a button? Say, I have a DNA-extraction syringe and I want to hybridize myself automatically. Is there a way to get mafia to click on the hybridize button in my workshed?
 

Bale

Minion
By the way, do you know how to get an ash to click on a button? Say, I have a DNA-extraction syringe and I want to hybridize myself automatically. Is there a way to get mafia to click on the hybridize button in my workshed?

digitrev answered the question, but to rephrase, there is no way to get mafia to "click on a button." However, if you know what html is triggered by clicking on the button you can use that as the parameter of a visit_url() command.

In this specific example, the cli command "camp" will do what you desire:
  • cli_execute("camp dnainject");
  • cli_execute("camp dnapotion");
 

Crowther

Active member
I've always used a combination of moods and mana burning to do this. It's not perfect, but close enough.
 

Bloody Knuckles

New member
I've never used mana burning before. It seems like exactly what I need. I'll try it out.

I don't like the way moods work. Since it only triggers when the buff is lost, you lose a lot of potential when you hit your mana cap and your buffs are still up. Then, your mana regen goes to waste.
 

Bale

Minion
I don't like the way moods work. Since it only triggers when the buff is lost, you lose a lot of potential when you hit your mana cap and your buffs are still up. Then, your mana regen goes to waste.

Set Mana burning. Mana Burning will cause buffs in your mood to be cast before you hit the mana cap so that you do not lose mana. I recommend a value of 60% for aftercore. Though this will only burn all buffs up to a value of a 1000 plus remaining turns.

I recommend the setting: Preferences -> General -> Cast summoning skills during buff balancing
That will cause mana burning to summon noodles, reagents and other things. Note that it will also cast librams if you have a libram set in your breakfast settings. If you don't set a libram in breakfast, then it won't.
 

Bloody Knuckles

New member
Set Mana burning. Mana Burning will cause buffs in your mood to be cast before you hit the mana cap so that you do not lose mana. I recommend a value of 60% for aftercore. Though this will only burn all buffs up to a value of a 1000 plus remaining turns.

I recommend the setting: Preferences -> General -> Cast summoning skills during buff balancing
That will cause mana burning to summon noodles, reagents and other things. Note that it will also cast librams if you have a libram set in your breakfast settings. If you don't set a libram in breakfast, then it won't.

It knows which buffs to cast by taking it from the mood list, correct? How does it know which buff to cast first?

This is what I have so far:

Code:
cli_execute("pull pantsgiving");
cli_execute("pull buddy bjorn");
cli_execute("pull Sneaky Pete's leather jacket ");
cli_execute("pull can of rain doh");
cli_execute("pull over-the-shoulder folder holder");
cli_execute("pull antique accordion");


cli_execute("tutorial.php?action=toot");

cli_execute("use letter from king ralph");
cli_execute("use pork elf goodies");

while ( item_amount( $item[ hamethyst ] ) > 0 )
	cli_execute("sell hamethyst");

while ( item_amount( $item[ baconstone ] ) > 0 )
	cli_execute("sell baconstone");

while ( item_amount( $item[ porquoise ] ) > 0 )
	cli_execute("sell porquoise ");

switch (my_class())
{
	case $class[turtle tamer]:
		cli_execute("pull boris's key lime pie"); 

	case $class[seal clubber]: 
		cli_execute("pull boris's key lime pie"); 
	
	case $class[accordion thief]:
		cli_execute("pull sneaky pete's key lime pie");
		
	case $class[disco bandit]:
		cli_execute("pull sneaky pete's key lime pie");
		
	case $class[pastamancer]:
		cli_execute("pull jarlsberg's key lime pie");

	case $class[sauceror]:
		cli_execute("pull jarlsberg's key lime pie");
}

cli_execute("pull 2 star key lime pie");

cli_execute("equip pantsgiving");
cli_execute("equip buddy bjorn");
cli_execute("equip Sneaky Pete's leather jacket");
cli_execute("use can of rain doh");
cli_execute("equip over-the-shoulder folder holder");

while ( item_amount( $item[turtle totem] ) < 1 )
{
	cli_execute("buy chewing gum on a string");
	cli_execute("use chewing gum on a string");
}

cli_execute("adventure 2 sloppy seconds diner");

cli_execute("camp dnainject");

cli_execute("adventure 10 The Spooky Forest");

And I have custom combat set up for Sloppy Seconds Diner that uses the DNA syringe, as well as goals turned on for the spooky forest (+1 mosquito larva), and if mana burning works out, I'll have a few buffs too.

I expect this to save me ten to twenty minutes each ascension =)

By the way, is there a mafia command to drink a speakeasy drink? I tried both "drink glass of "milk"" and "buy glass of "milk"" but I got "You need 1 more glass of "milk" to continue." and nothing, respectively.
 
Last edited:

Bale

Minion
It knows which buffs to cast by taking it from the mood list, correct? How does it know which buff to cast first?

It casts whichever buff for which you have the fewest turns.

By the way, is there a mafia command to drink a speakeasy drink? I tried both "drink glass of "milk"" and "buy glass of "milk"" but I got "You need 1 more glass of "milk" to continue." and nothing, respectively.

"drink lucky lindy" works for me so I can only suspect your current clan lacked a speakeasy booth or you did not have 500 meat to buy the milk.
 

Bloody Knuckles

New member
No, I was able to buy a drink right after, so I am quite sure that is not the case. I shall do more testing the next time I ascend.

I also tested "drink lucky lindy", and it worked.

By the way, is it possible to disable safe adventuring? I tried to script in "adventure 2 sloppy seconds diner" but was denied, because I was too low level.

Edit: Tried "test speakeasy" got error:
Code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        KoLmafia v16.4 r14575, Windows 8.1, Java 1.7.0_67
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread of KoL's
 Gameplay-Discussion forum. If you would like the KoLmafia dev team
 to look at it, please write a bug report at kolmafia.us. Include
 specific information about what you were doing when you made this
 and include this log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Sun Oct 05 01:12:02 EDT 2014
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.lang.NullPointerException: null
java.lang.NullPointerException
	at net.sourceforge.kolmafia.request.ClanLoungeRequest.parseSpeakeasy(ClanLoungeRequest.java:1415)
	at net.sourceforge.kolmafia.textui.command.TestCommand.run(TestCommand.java:433)
	at net.sourceforge.kolmafia.KoLmafiaCLI.doExecuteCommand(KoLmafiaCLI.java:596)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:549)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:450)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:318)
	at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.handleQueue(CommandDisplayFrame.java:190)
	at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:164)

There's a null field somewhere in the speakeasy parser, which makes sense, because when I try to drink a thermos of whiskey it notes: "you need one more thermos of whiskey".

Asking for people to reproduce this to confirm as a bug.
 
Last edited:

lostcalpolydude

Developer
Staff member
To automate adventuring, tell mafia to do something besides "attack with weapon". Set it to use a CCS instead.

The error with the test command is because you need to use "test load htmlfile" before using that command. I fixed it in 14805 to not produce a debug log when it isn't used properly. Next time you could be more helpful by mentioning the no HTML loaded. line just before the message about a debug log.
 

Veracity

Developer
Staff member
By the way, is there a mafia command to drink a speakeasy drink? I tried both "drink glass of "milk"" and "buy glass of "milk"" but I got "You need 1 more glass of "milk" to continue." and nothing, respectively.
It's a problem with how we parse the drink command for the glass of "milk" (and cup of "tea" and thermos of "whiskey"). The actual names use HTML entities instead of quotes and we don't do fuzzy matching when looking for speakeasy drinks, which would canonicalize your quotes into HTML entities.

There is a feature request for that around somewhere.

You could use:

Code:
drink 1 glass of "milk"
and it should work.
 
Top