Any script requests?

Alhifar

Member
Once again pulled from slime.ash. Not all skills are accounted for, only major ones used in aftercore. It shouldn't be THAT hard to add in new skills, though.
Code:
int attack_damage_dealt()
{
	int weapon_damage = max( 1 , floor( .1 * get_power( equipped_item( $slot[weapon] ) ).to_float() ) );
	int offhand_damage = 0;
	if( weapon_type( equipped_item( $slot[offhand] ) ) != $stat[none] )
		offhand_damage = max( 1 , floor( .1 * get_power( equipped_item( $slot[offhand] ) ).to_float() ) );
	int elem_damage = numeric_modifier( "Hot Damage" ) + numeric_modifier( "Cold Damage" ) + numeric_modifier( "Spooky Damage" ) + numeric_modifier( "Sleaze Damage" ) + numeric_modifier( "Stench Damage" );
	int bonus_damage = numeric_modifier( "Weapon Damage" ) + elem_damage;
	int lts_factor = 1;
	int damage;
	
	float spell_per;
	
	boolean shieldbutt = false;
	boolean noisemaker = false;
	boolean blowout = false;
	boolean sillystring = false;
	boolean saucegeyser = false;
	boolean wotpl = false;
	boolean ff = false;
	
	for i from 0 upto 30
	{
		switch ( get_ccs_action( i ) )
		{
			case "skill lunging thrust-smack":
				lts_factor = 3;
				break;
			case "skill thrust-smack":
				lts_factor = 2;
				break;
			case "skill shieldbutt":
				shieldbutt = true;
				break;
			case "item divine noisemaker":
				noisemaker = true;
				break;
			case "item divine blowout":
				blowout = true;
				break;
			case "item divine can of silly string":
				sillystring = true;
				break;
			case "skill saucegeyser":
				saucegeyser = true;
				break;
			case "skill weapon of the pastalord":
				wotpl = true;
				break;
			case "skill fearful fettucini":
				ff = true;
		}
	}
	
	int musc_dam = max( 0 , ( my_buffedstat( $stat[muscle] ) ) - monster_defense() );
	if( have_skill( $skill[Eye of the Stoat] ) && lts_factor == 3 )
	{
		if( my_class() == $class[Seal Clubber] )
			musc_dam = max( 0 , ( my_buffedstat( $stat[muscle] ) * 1.3 ) - monster_defense() );
		else musc_dam = max( 0 , ( my_buffedstat( $stat[muscle] ) * 1.25 ) - monster_defense() );
	}
	
	if( weapon_type( equipped_item( $slot[weapon] ) ) == $stat[none] ) musc_dam = musc_dam * .25;
	if( shieldbutt ) offhand_damage = get_power( equipped_item( $slot[offhand] ) ) * .1;
	switch
	{
		case noisemaker:
			damage = my_buffedstat( $stat[muscle] );
			break;
		case blowout:
			damage = my_buffedstat( $stat[moxie] );
			break;
		case sillystring:
			damage = my_buffedstat( $stat[mysticality] );
		case saucegeyser:
			spell_per = ( 1 + numeric_modifier( "Spell Damage Percent" ) ) / 100;
			damage = floor( spell_per * ( 35 + ( .35 * my_buffedstat( $stat[mysticality] ) ) + numeric_modifier( "Spell Damage" ) ) );
			break;
		case wotpl:
		case ff:
			spell_per = ( 1 + numeric_modifier( "Spell Damage Percent" ) ) / 100;
			damage = floor( spell_per * ( 32 + ( .35 * my_buffedstat( $stat[mysticality] ) ) + numeric_modifier( "Spell Damage" ) ) );
			break;
		default:
			damage = musc_dam + bonus_damage + ( weapon_damage * lts_factor ) + offhand_damage;
	}
	return damage;
 
Last edited:
thanks Alhifar, that looks like exactly what I wanted to do. I'm surprised mafia had no quick way to do this. Does this take into account if it is a ranged weapon or not?
 
cakyrespa had a very nice idea for a script he's writing, which was when you need to have lots of formulas like this that would normally require a massive switch statement, to instead write the formulas in Reverse Polish Notation (RPN) and put them in a map file. And then evaluate the formulas using the RPN calculator we wrote. (I don't know if its officially posted here yet.) What do you guys think about using that same idea for this script? I think it would make it a lot more maintainable. That way items and skills could easily be added just by adding a line to the data file and the code would be a lot cleaner looking.
 

dj_d

Member
Why would you need to have items and skills in a data file? They're already in mafia's data files, updated for you automatically, along with handy accessor functions to look at them.
 
Why would you need to have items and skills in a data file? They're already in mafia's data files, updated for you automatically, along with handy accessor functions to look at them.

Does that include things like thrust smack? because I see Alhifar is calculating them himself. The mafia files would work for the items that do some constant amount of damage, but would they also work for the skills in Alhifar's script?
 

dj_d

Member
I don't know offhand. Some of the additions are pretty recent. But rename kolmafia.jar to kolmafia.zip and look inside the /data folder to see what data files are there and if you can use them. You should, at the very least, get most of what you need on items. I can imagine skills requiring some spading on your own.
 

cakyrespa

Member
Why would you need to have items and skills in a data file? They're already in mafia's data files, updated for you automatically, along with handy accessor functions to look at them.

The reason I'm using them as data files is because not all the data seems to be accessible from inside ASH, but also because I want to be able to make calculations based on unbuffered or theoretical stats (since AFAIK maximize doesn't do formulas like "ml, moxie > ml + 197, mus > ml + 187"). Plus, I'm doing some calculations based on if I use things like candy hearts or snowcones, which means I need to figure it out without actually doing it; some of these things are a bit harder to calculate abstractly from inside KolMafia.

http://kolmafia.us/showthread.php?t=2433

I consider RPN to be pretty much stable at this point, or at least happily usable.

Also, for my work, I'm using the various numeric_modifiers() calls on top of formulas. Basically using KoLmafia for the non-formulaic data and only entering formulas that are based on that abstract data (like the effectiveness of a volleyball/sombreo familiar against the average level of a location when modified by the monster level adjustments from equipment, effects, and spells).
 
Last edited:

Bale

Minion
I still don't understand why you need data files. Are you saying that the data formulas hold your formulas instead of just creating a function for each formula? It sounds a lot more effort and processing to get the same result.
 

dj_d

Member
CR, are you aware that you can access items like mafia's internal equipment.txt and friends from within your script? That's what Bale and I are talking about - it gives you access to the raw info.
 

Sputnik1

Member
I am using one of my accounts as a meat farmer and I wanted a way for Mafia to output to a text file a list of data so I can analyze how well I'm farming and how well buffs and what not are working.

I currently would like it to write to a text file...

Total Advs Spent
Daily Meat Farmed
Meat Farmed per Advs Spent

and I was just trying to figure out how to do it by calling on how much meat is in my closet at the beginning of my run and then finally how much there is at the end, then doing the calculations by subtraction and then calling upon how many adventures I used to get the meat per adv ratio

any help would be great!
 

halfvoid

Member
I am using one of my accounts as a meat farmer and I wanted a way for Mafia to output to a text file a list of data so I can analyze how well I'm farming and how well buffs and what not are working.

I currently would like it to write to a text file...

Total Advs Spent
Daily Meat Farmed
Meat Farmed per Advs Spent

and I was just trying to figure out how to do it by calling on how much meat is in my closet at the beginning of my run and then finally how much there is at the end, then doing the calculations by subtraction and then calling upon how many adventures I used to get the meat per adv ratio

any help would be great!

if you were writing a script you could place this at the begining of it:

Code:
int start = my_meat();
int startadv = my_adventures();

then the bulk of your farming stuff (ie. where you want to farm, for how many adventures and whatnot)

with this at the end of your script:

Code:
int changemeat = my_meat() - start;
int changeadv = startadv - my_adventures();

print("Meat Change: " + changemeat + "Adventures Used: " + changeadv + " | Meat Per Adventure: " + changemeat / changeadv);

i use something similar on my sandworm and floaty sand farming script which also tells me how many spices and spice melanges (3 in the last week) i've gotten as well.
 

mredge73

Member
I said that earlier in this thread. I'm not sure if you missed it or ignored it...

I built one that does that, it is a rather complex script (although not very large) that could probably be trimmed down and posted if there is enough persuasion. Clan bot scripts are hard to come by on this forum because script authors like to keep them unique to their clan. I was thinking of selling a library of clan bot scripts but haven't decided on how to do that yet and some of them still require regular maintenance.
 
@sputnik
I did something like that in my farming script except I just printed it to the screen, not to a file. I did pretty much exactly what halfvoid was describing. Is that what you wanted or did you mean you want something that would tell you how much meat you're gaining by using certain buffs and items?

@giraffe man
Sorry, I wasn't ignoring it, I must've missed it. It doesn't sound like it would be too hard, though it would probably involve lots of manually visiting php pages, so it would take a little bit of research to find the right pages and parameters and all of that.

Sorry if I've been a little slow guys, I'm pretty busy now that I'm back at school. I'll try to get to some of these things this weekend
 

Mecha

New member
A script for doing the Hyboria quest would be wonderful. If you need any Agua de vida, just let me know.
 

zarqon

Well-known member
Hyboria would be a chore to write. A ton of choiceAdventure settings to research, some of which actually change options depending on progress, not to mention if you try to auto-adventure with a choiceadv as a goal, you don't know if it stopped due to using up your adventures for that bottle or successfully finding the choiceadv. I think I saw someone else asking about handling changing choiceadventures for this exact purpose... wonder if they got it figured out or not.
 

giraffe man

New member
Thanks, I didn't think it would be hard. I've searched the forums and the closest thing to something that changes ranks is the URL, clan_members.php?action=modify&pids[]=1937445&level1937445=0&modify=Modify Members.
 
Thanks, I didn't think it would be hard. I've searched the forums and the closest thing to something that changes ranks is the URL, clan_members.php?action=modify&pids[]=1937445&level1937445=0&modify=Modify Members.

I don't know if I actually have access to that for my clan... Well I can see if I can get it
 
Top