Maximize.ash, maximize equipment in one command.

Status
Not open for further replies.
[quote author=Paragon link=topic=1410.msg8100#msg8100 date=1210568506]
Yea... I saw that when I was writing the script in the beginning. It was my little secret I didn't want to deal with. Each thing is meant to check the highest value... hacking a fix would be possible. To be perfectly honest this is by far the most used item of code I have ever created. But this is kind of where my lack of experience shows through. I am currently deciding to do a complete re-write or if I should grit my teeth and stich this project back together. As soon as I figure that out I'll release a version that addresses the speed issue, the cheifstaff problem (It's tricker than you think even with item_type returning cheifstaff), the idea of giving a primary and secondary attribute to maximize and this problem.

BTW: Sorry if this msg is odd, my head is in the clouds right now.
[/quote]


A quick fix to give the ability to maximize noncombats would be to add a noncombat field. For every item that adds to the combat % this would be a negative number. For every item that decreases combat % it would be a positive (the opposite of the combats field). You'd then be able to maximize non-combats.

I did something similar for farming. I wanted items that are +meat AND +items to be used first instead of similar items that are just +meat. So like instead of "toy maglev monorail" which is +10 meat it would use mayfly bait necklace because it's +10 meat as well, but also +10 items...so it's "better" for farming.

So I added a "farm" field calculated as: meat + (items / 2). So mayfly bait necklace I gave a 15 for farm, because it's 10 meat, 10 items. A 20 meat item is still "better", so if I have one it'll use that instead. But it makes the mayfly bait necklace favored instead of a similar item that's +meat only.

I think the formula is a little skewed, as it then makes rabbit's foot necklace used instead of toy maglev monorail. So which is really better, +10 meat only or +7 meat and +7 items?

Anyone have any thoughts? Note that I didn't change any code - just edited ItemMap.txt
 
[quote author=dangerpin link=topic=1410.msg8994#msg8994 date=1222300880]
I'd love to see your updated itemmap.txt, can you upload it?
[/quote]

I may have missed a few items, but here it is:
 

Attachments

I have noticed that there have been some issues with the newer items not being supported. I don't really have any of the items being talked about since they are mainly IToMs but if someone could test the update function for me I would really appreciate it. The way that it is supposed to work is that if you update the data files using kol mafias update function, you should be able to update the item file using the -update option. Sometimes the first line in those data files are formatted diffrentlly, if this causes issues you can attempt to delete the first line, run the update function then return the line. This should only need to be every once in awhile... particularly when an item that you want to use isn't being used because it is too new.
@hairball: That was a great idea adding your own fields. Was there any easy way to do it? Or did you do it by hand? I guess if you already knew which items you were looking to add the field too it wouldn't be to hard to do by hand, though if you wanted to apply some kind of formula to it you could proably write another script to run through the items... actually, these custom fields *could* be a great way to fix up a few of the bugs that I have had difficulty squashing.

@muhandes: About the unequipping and re-equiping. This occurs with every item that only one can be equipped with. I did this because i was running into trouble attempting to put what the script though was the first of a single equip item while already wearing one of those items which fails <fairly> silently, then it would unequip the one you had on to put the item that it was going to use in that slot. For example with your tube sock, if you had it on acc3 the script would try to put it one acc1, fail then replace the sock on acc3 with something else causing an empty slot and not using sock. I can't currently think of a good fix because... we to tell the truth the code is pretty sloppy.

@darkness: does the amount of hp that is given constant? or at least some kind of easy to figure linear formula? If so, it wouldn't be TOO hard to add that in.
 
[quote author=Paragon link=topic=1410.msg9013#msg9013 date=1222416674]

@hairball: That was a great idea adding your own fields. Was there any easy way to do it? Or did you do it by hand? I guess if you already knew which items you were looking to add the field too it wouldn't be to hard to do by hand, though if you wanted to apply some kind of formula to it you could proably write another script to run through the items... actually, these custom fields *could* be a great way to fix up a few of the bugs that I have had difficulty squashing.
[/quote]

I did it by hand, just searching for the text "meat drop" with my editor and then adding the ,farm: bit at the end. I think I forgot to go though looking for item drop and making sure the items that are JUST item drop have the farm: value.
 
[quote author=hairball link=topic=1410.msg8993#msg8993 date=1222289227]
....
I think the formula is a little skewed, as it then makes rabbit's foot necklace used instead of toy maglev monorail. So which is really better, +10 meat only or +7 meat and +7 items?

Anyone have any thoughts? Note that I didn't change any code - just edited ItemMap.txt
[/quote]
There is no "really better", it depends heavily on what you are planning to do.
I made a spreadsheet to optimize my castle farming (one day I might share it) and according to it 1% meat is 1.365, while 1% items is 0.791, so you are close to being right. An exact number would be 1% item = 0.58% meat.
7% meat + 7% items is in fact better than 10% meat by a small margin.
 
Not sure why this didn't work:

Code:
> call maximize.ash mox

0
Finding best outfit for mox
Equipping:
__________
Hat: eyepatch(0)
Shirt: none(0)
Pants: swashbuckling pants(0)
Weapon: pool cue(0)
OffHand: none(0)
Acc1: Jolly Roger charrrm bracelet(0)
Acc2: Boss Bat bling(0)
Acc3: stuffed shoulder parrot(0)
Mod:
__________
Putting on eyepatch...
Equipment changed.
Putting on swashbuckling pants...
Equipment changed.
Wielding pool cue...
Equipment changed.
Putting on Jolly Roger charrrm bracelet...
Equipment changed.
Putting on Boss Bat bling...
Equipment changed.
Putting on stuffed shoulder parrot...
Equipment changed.
Best outfit for mox Equipped.
Done.
It didn't use my badass belt which is better than a Boss Bat bling.

Edit: Actually, it didn't even use my stainless steel suspenders, which are much better.
 
There are two ways to maximize, the way this is built. There is maximize moxie and maximize "moxie percent", if I remember correctly. At lower moxie levels the more powerful straight moxie items would be better, at higher moxie levels the percentage would always be better. In the middle you have to mix and match and as this script is currently written there is no way to do so automatically.

Stainless steel suspenders are a "moxie percent" item.

Now badass belt vs boss bat bling is another matter and I don't know why that didn't equip, I would try it with "moxie" instead of just "mox" and see if there is a difference.
 
Actually, one of the things that i wrote this for was to easily get the best main regardless of all other factors. To do this I made a compare function that checked if it was a percent increaser or a absolute increasor, the maximize command should already take into account percentage increasers for you. particularly with main stats.

  I noticed that it put on the eyepatch, the swashbuckling pants and the stuffed shoulder parrot... thats the swashbuckling getup and that outfit gives +7 mox. If you check the percentage you would gain from those other items it would most likely not exceed 7.

  If this is not the case then I should look for bugs. And remeber, all percentage increasers are determined by base moxie (in kol not my script... though in my script also by extension.)

*edit*
    That still doesn't explain why it didn't use the badass belt, Check to make sure that you have the stats to equip the items that it passed up, it may have not used them because you were unable to equip it... this through my off on my Softcore alt for a bit.

*edit 2*
Actually, can you post your level, and stats? (mus, mys, and mox)
 
Dangerpin might have got the answer, I tried "moxie" instead of "mox" and at least the suspenders are now equipped.
I can't check the badass belt vs. boss bat bling situation right now, I already have better items. I can try after breaking the prism.
 
Here's another odd one:
Code:
> call maximize.ash monster level

0
Finding best outfit for monster level
Taking off grumpy old man charrrm bracelet...
Equipment changed.
Equipping:
__________
Hat: miner's helmet(0)
Shirt: none(0)
Pants: Can-Can skirt(0)
Weapon: giant needle(0)
OffHand: flaming talons(0)
Acc1: grumpy old man charrrm bracelet(0)
Acc2: ring of aggravate monster(0)
Acc3: grumpy old man charrrm bracelet(0)
Mod:
__________
Wielding giant needle...
Equipment changed.
Putting on grumpy old man charrrm bracelet...
Equipment changed.
Taking off grumpy old man charrrm bracelet...
Equipment changed.
Putting on grumpy old man charrrm bracelet...
Equipment changed.
Best outfit for monster level Equipped.
Done.
You can only equip one grumpy old man charrrm bracelet at a time.
 
Hey, i found this script really useful but the long time to trim down the limit of items started to really bug me so I've made a few changes and thought it might help others
the main changes are in utils.ash, instead of trimming out each item each time, it now saves a trimmed list specific to the attribute

in Records.ash i changed the datafile locations so i used an extra variable for the extension
Code:
string extensionDataFile = ".txt";
string equipmentDataFile = "maximize\\ItemMap"; #Where to put new modifier map file
string outfitDataFile = "maximize\\OutfitMap";  #Where to put new outfit map file
string weaponDataFile = "maximize\\weaponMap"; # where to put new weapon map file

and adjusted maximize.ash to use the new paths, just change the file_to_map bits (three of them) from
Code:
file_to_map(equipmentDataFile, itemModMap);
to
Code:
file_to_map(equipmentDataFile + extensionDataFile, itemModMap);

and finally change utils.ash, replace the TrimModMaps
Code:
void TrimModMaps(string attribute) {
 clear (TrimmedOutfitModMap);
 clear (TrimmedItemModMap);
 clear (TrimmedweaponMap);

 if (attribute == "all"){specialTrim(); attribute = "cold resist"; return;}

	int [slot, item] TrimmedItemModMap2;
 file_to_map(equipmentDataFile + "_" + attribute + extensionDataFile, TrimmedItemModMap2);
 file_to_map(outfitDataFile + "_" + attribute + extensionDataFile, TrimmedOutfitModMap);
 ##file_to_map(weaponDataFile + "_" + attribute + extensionDataFile,TrimmedweaponMap);

 if (count(TrimmedOutfitModMap) == 0) {
	 foreach outfit in outfitmodmap {
	  if (contains_text(outfitmodmap[outfit].mod, attribute)) {
	   TrimmedOutfitModMap[outfit] = copy_ODRecord(outfitmodmap[outfit]);
	  }
	 }
 	if (count(TrimmedOutfitModMap) > 0) {
 		map_to_file(TrimmedOutfitModMap, outfitDataFile + "_" + attribute + extensionDataFile);
 	}
	}
	
	int Mod;
	if (count(TrimmedItemModMap2) == 0) {
		V_PRINT ("Searching all items... (this will be slow)", 1);
	 foreach slot in itemModMap {
	  foreach item in itemModMap[slot] {  
	   V_PRINT(("Attempting to trim item " + to_string(item)),3); 
   		Mod = getModValue(item, itemModMap[slot,item], attribute);
   		if (Mod>0) {
	    	V_PRINT (item + " has a " + attribute + " modifier of: " + Mod,2);
	    	TrimmedItemModMap2[slot,item]=Mod;
	  		}
	  }
	 }
	 	if (count(TrimmedItemModMap2) > 0) {
 		map_to_file(TrimmedItemModMap2, equipmentDataFile + "_" + attribute + extensionDataFile);
 	}
	}

 foreach slot in TrimmedItemModMap2 {
  foreach item in TrimmedItemModMap2[slot] {  
   V_PRINT(("Coutning/checking item " + to_string(item)),3); 
			if ((available_amount(item)>0) && can_equip(item)) { 
    	if (class_modifier(item, "Class") == $class[none] || class_modifier(item, "Class") == my_class()) { 
     	TrimmedItemModMap[slot,item]=TrimmedItemModMap2[slot,item];
   		}
   	}
  }
 }
}

if you update your ItemMap.txt (or OutfitMap.txt) you just need to delete the generated ItemMap files (such as 'ItemMap_meat drop.txt') and the script will regenerate them

hope this helps

edit: just noticed this doesnt handle the percentage calculations very well, it should still help if your low level like me, ill have a look at a workaround for the percentages
 
Bug: It won't equip my Cup of Infinite Pencils.

Finding best outfit for meat
Equipping:
__________
Hat: none(0)
Shirt: none(0)
Pants: none(0)
Weapon: muculent machete(0)
OffHand: none(0)
Acc1: pulled porquoise pendant(0)
Acc2: booty chest charrrm bracelet(0)
Acc3: ratskin belt(0)
Mod:

(results in +250% meat)

equip cup of infinite pencils

(results in +265% meat)

Really cool script though!
 
I did a little work on this thing and I want to check to make sure it works before I change the update thing. Could someone who owns a bit of Grimacite stuff please check this out to see if it is handling it correctly? I don't personally own anything that works on moon light, but from what I can tell from the wiki this should work... unless i screwed up code in the main script. Anyway... just overwrite the special.ash with the one attached, there shouldn't need to be any other modifications.
 

Attachments

[quote author=Paragon link=topic=1410.msg10118#msg10118 date=1228291777]
I did a little work on this thing and I want to check to make sure it works before I change the update thing. Could someone who owns a bit of Grimacite stuff please check this out to see if it is handling it correctly? I don't personally own anything that works on moon light, but from what I can tell from the wiki this should work... unless i screwed up code in the main script. Anyway... just overwrite the special.ash with the one attached, there shouldn't need to be any other modifications.
[/quote]

I've got all three Depleted Grimacite +Adventure items (depleted Grimacite grappling hook, depleted Grimacite gravy boat, and depleted Grimacite weightlifting belt).

None of them were recognized as +adventure or +stat items when I tested.

I opened the special.ash that you posted and it doesn't appear to have entries for the new items, so I added 'em:

Code:
  if (i=="depleted Grimacite gravy boat")
  {
		return to_int(my_basestat($stat[mysticality])*((n*5)/100));
  }
  if (i=="depleted Grimacite grappling hook")
  {
		return to_int(my_basestat($stat[moxie])*((n*5)/100));
  }
  if (i=="depleted Grimacite weightlifting belt")
  {
		return to_int(my_basestat($stat[muscle])*((n*5)/100));
  }

Still didn't work with those entries, so I added 'em in ItemMap.txt. I'm not sure I got the entries perfect, but maximize then recognized them as +adventure items.

Wasn't able to get them to work as +stat items, but that may be because +stat is currently more powerful than +stat%.

With that said, here are my ItemMap.txt entries:
Code:
acc1	depleted Grimacite weightlifting belt	muscle percent: +0, adventures: +1
acc1	depleted Grimacite grappling hook	moxie percent: +0, adventures: +1
off-hand	depleted Grimacite gravy boat	mysticality percent: +0, adventures: +1
 
hm... OK, I had only put in entries for the original grimacite stuff... mainly because I didn't want to deal with the items that had two variable effects yet. But looking at the post. First try to change their entries from adventures +1: to adventures: +0 the zero indicates that the item modifies these values, but by a variable amount. That might solve the problem with it not being recognized as a +adv item.

The second thing is that in special.ash, since it modifies two attributes, we need to figure out which of the two to return this time.
Code:
  if (i=="depleted Grimacite gravy boat")
  {
   if (contains_text("adventures", attribute)==true){return n;}
   return to_int(my_basestat($stat[mysticality])*((n*5)/100));
  }
  if (i=="depleted Grimacite grappling hook")
  {
   if (contains_text("adventures", attribute)==true){return n;}
   return to_int(my_basestat($stat[moxie])*((n*5)/100));
  }
  if (i=="depleted Grimacite weightlifting belt")
  {
   if (contains_text("adventures", attribute)==true){return n;}
   return to_int(my_basestat($stat[muscle])*((n*5)/100));
  }
 
Sorry if you didn't want to work on the multi-var items yet; I saw the one entry and decided to try to run with it.

With "adventures: +1" the items were being recognized as +adventure items.

When I set it to "adventures: +0" and used the new code it doesn't equip any of the depleted grimacite items for adventures; I should be getting a gravy-boat in my off-hand, even if the current +1 doesn't win out over my watches/reindeer/meatcar.

Incidentally, the script is equipping two watches and a TP reindeer, rather than a watch, TP reindeer, and TP meatcar when I choose Adventures.
 
Status
Not open for further replies.
Back
Top