Current mood buffs?

oly0015

Member
Been reading the wiki for awhile and just curious if this is possible, would save me a lot of trouble. Now i know I can get the current mood name as a property but is there any way to get the buffs listed under the current mood?
 

Spiny

Member
Your moods are stored within a text file(s) within .kolmafia -> settings. Beyond that, not sure how I'd use that scriptomatically to find out the buffs within the moods.
 

Bale

Minion
is there any way to get the buffs listed under the current mood?

The CLI command you're looking for is...

Code:
[COLOR="#808000"]> trigger[/COLOR]

Always, call betweenBattleMood.ash
When I get Apathy, cast 1 Disco Power Nap
When I get Coated in Slime, call chamois.ash
When I get Cunctatitis, cast 1 Disco Power Nap
When I get Easily Embarrassed, cast 1 Disco Nap
When I get Embarrassed, cast 1 Disco Power Nap
When I get Tetanus, cast 1 Disco Power Nap
When I run low on Butt-Rock Hair, use 5 hair spray
When I run low on Fat Leon's Phat Loot Lyric, cast 1 Fat Leon's Phat Loot Lyric
When I run low on Leash of Linguini, cast 1 Leash of Linguini
When I run low on Polka of Plenty, cast 1 The Polka of Plenty

If that's not the answer, then I don't understand the question.
 

oly0015

Member
Sorry bale, guess i didn't explain that enough

I was just asking if there was a way to read in the buff triggers for a current mood into an array for a script. I was just wondering for a buff function of one of my scripts if that could work vs. me having to input the data manually. If i could just read in the moods text file itself that would be enough and i'd parse it :/

Ex.

User changes mood to castle farm in the script
The script collects what buffs are in that mood
It then contacts buffbots to get the buffs

The rest i can do already, i'd just like to try to dynamically access the mood list vs having to write the buffs in a second time.
 

Bale

Minion
Sorry, but I don't think there is a way to do that. The moods text file is not formatted for use with file_to_map() since is only a single string on each line.
 

Fluxxdog

Active member
Honestly, i think I have only 1 thing in my moods, and that's for "Slimed => chamois.ash". Everything else I use custom scripts to micro manage for me as a beforeBattleScript. I have it importing 11 smaller scripts (why aren't you laughing?) to handle certain IotMs, familiars, buffs that I may or may not have, mana saving for summoning items, checklist for progressing through a run, some of which import their own scripts to handle certain tasks (BTW, big shout out to libramBurn.ash and RainbowGravitation.ash!)... I'm starting to think I have too much time on my hands.

Anyway, you should be able to create scripts to do exactly what you want and run them as part of a betweenBattleScript.
my_location() returns the location you're about to adventure at in a bBS.
kmail() will mail the buffbot at your request.
wait() will kill some time while you're waiting for the buff to kick in.

In fact... That doesn't sound like a bad idea, I may want to do that myself.
 

oly0015

Member
k thanks, not a biggie just was curious if there was a way and it was not documented is all.

I just associated a kingdom of buffing type format to my script with a "buffbot mood" for now which can handle skills and buffs. Ex if it asks for polka that will go through a buffbot but thingfinder will get called directly. Since i don't believe there is a effect to item conversion as of yet the standard mood management will have to do for that half.
 

heeheehee

Developer
Staff member
Sure, there's no built-in effect-to-item conversion yet, but if you wanted to build a map, you could probably do so via:
PHP:
int[effect, item] effect_to_item;
foreach i in $items[]
    if(string_modifier(i, "Effect")!="") {
        effect f = string_modifier(i, "Effect").to_effect();
        effect_to_item[f, i] = numeric_modifier(i, "Effect Duration");
    }

You could then access it via foreach a,b in effect_to_item[$effect[Sugar Rush]], for instance, where a is an item that gives the effect and b is the duration from that item.

The problem here (why there's no built-in function for effect => item conversions) is that multiple items can confer the same effect.
 

oly0015

Member
If anyone's curious this is what i came up with after heeheehee posted that bit of code here ya go. It's only the effect -> item part so far, theres still a couple things i got to work out with the other side to be finished up. Basically with the setup i had made you put in the effect, wanted turns, and way to get the items.

note: to simplify things a bit it only works for "use" items that give a blank item type
note2: the type basically goes between use any (retrieve_item), use only from mall (buy), or only use whats on hand (by item_amount)
Code:
int getfixitems(int fix, item it, string type)
{
	if(type == "auto")
		retrieve_item( fix , it );
	else if (type == "mall")
		buy( fix , it );
	else if (type == "inventory")
	{
		if ( item_amount( it ) < fix )
			fix = item_amount( it );
		if ( item_amount( it ) == 0 )
			print ("Currently out of: " + it + " switch type to auto or continue without buff","red");
	}
	else
	{
		print ("Type: " + type + " does not conform to standards (auto|mall|inventory), going to auto","red");
		fix = getfixitems(fix, it, "auto");
	}
	return fix;		
}
boolean is_item (effect e)
{
	int index = 0;
	foreach i in $items[]
		if(string_modifier(i, "Effect")!="") 
		{
			string test = item_type( i );
			if (test == "")
			{
				string f = string_modifier(i, "Effect");
				f = replace_string(f, "&#153;", "");
				effect g = f.to_effect();
				if (g == e)
				{
					index += 1;
				}
			}
		}  
	if (index > 0)
		return true;
	return false;
}
void ef_toitem (effect e, float amount, string type)
{
	int[effect, item] effect_to_item;
	foreach i in $items[]
		if(string_modifier(i, "Effect")!="") 
		{
			string test = item_type( i );
			if (test == "")
			{
				string f = string_modifier(i, "Effect");
				f = replace_string(f, "&#153;", "");
				effect g = f.to_effect();
				if (g == e)
				{
					effect_to_item[g, i] = numeric_modifier(i, "Effect Duration");
				}
			}
		}  
	int cost;
	int value = 999999999;
	int stop = 50000;	//Mall price cap
	int turns;
	item it;
	foreach a,b in effect_to_item
	{
		cost = mall_price(b);
		if (cost < stop)
		{
			int it2 = effect_to_item[a,b];
			if ((it2!=0)&&(cost!=0))
			{
				int test = cost / it2;
				if (test < value)
				{
					it = b;
					value = test;
					turns = it2;
				}
			}
		}
	}
	if (value != 999999999)
	{
		int current = have_effect(e);
		if (current !=0 )
		{
			float left = amount - current;
			if (left > 0)
			{
				float get = left/turns;
				int fix =  ceil( get );
				use( getfixitems(fix, it, type), it );
			}
			else
				print ("Currently have minimum turns of: " + e,"red");
		}
		else
		{
			float get = amount/turns;
			int fix = ceil( get );
			use( getfixitems(fix, it, type), it );
		}
	}
	else
		print("Error with " + e + " could not find suitable item under " + stop,"red");
}
void main()
{
	ef_toitem($effect[polka face], 20, "auto");
}
 

Attachments

  • test3.ash
    2.4 KB · Views: 49
Last edited:

heeheehee

Developer
Staff member
Oh, and another note: Because of the way that Mafia gets the effect name/duration, this only works for items that KoL classifies as potions. So you can't use it, say, for getting the item for $effect[Extremely Poor Taste] ($item[escargotsicle]). I guess you could do some parsing of, uh, statuseffects.txt and merge the data?
 

oly0015

Member
Yeah already figured that one out, "note: to simplify things a bit it only works for "use" items that give a blank item type". I'm handling food/booze on another diet type function as an alternative to eatdrink so this will just take care of potions.

Thanks for the help all :)
 
Top