Scriptlet: RestorerSelecter

First, let me define what I mean by scriptlet.

A scriptlet is a script that by itself, does absolutely nothing. In fact, if you try to run this script by itself, it will error out and tell you that you were silly to try.

It is intended to be imported into other scripts, scripts that would - presumably - use the function contained therein.

So this is what this script does.

To use it properly, you must put this as one of the first - if not first - lines in your script:

Code:
import <RestorerSelecterASH.ash>;

Note: This assumes that you do not rename the script.

Now whenever you want to use the function in your script, you would use something like this:

Code:
restorer_selecter( "most", "mp")
Code:
restorer_selecter( "best", "mp")
Code:
restorer_selecter( "most", "hp")
or
Code:
restorer_selecter( "best", "hp")

restorer_selecter returns an item name type.

Now, the options selected might be obvious. But let me explain what they do.

"most" returns the name of the appropriate restorer that you have most of in your inventory.
"best" returns the name of the appropriate restorer in your inventory that is the 'best.' (Best is subjective, so I use the term loosely.)
"mp" selects from among your MP restorers.
"hp" selects from your HP restorers.

Now, the list of each type of item is rather skimpy. I selected the nine most common items from each type and ordered them by value restored. I tried to select the items most usefull to most people.

I (hopefully) clearly marked them in the beginning of the script to allow others to customize the lists to suit their needs.

Currently the MP items are as follows, from "worst" to "best:"

soda water, Knob Goblin seltzer, Mountain Stream soda, Dyspepsi-Cola, green pixel potion, tiny house, Knob Goblin Superseltzer, blue pixel potion, phonics down

And the HP items are:

Doc Galaktik's Pungent Unguent, Doc Galaktik's Ailment Ointment, Doc Galaktik's Restorative Balm, Doc Galaktik's Homeopathic Elixir, cast, tiny house, red pixel potion, phonics down, scroll of drastic healing

WARNING: restorer_selecter will return a value of the "worst" item of either type even if you have none of the appropriate restorers in inventory. So, I would strongly recommend doing a quantity check before you try to use an item.

(Note: For those that are following the KoLmafia thread in the Gameplay forums, this is the function I was asking about the variable passed by reference. Of course, it has suffered 3 mutations since then... But this is the result.)
 

Attachments

  • RestorerSelecterASH.ash
    2.7 KB · Views: 119

TrickyBeta

New member
Are Medicinal Herbs included? And if not, could they be included?

EDIT: I guess not. meh. I'll try to add this in and post if I can.
 
No, I didn't put Medicinal Herbs on the list because "most" people wouldn't be able to use them.

It is easy enough to adjust the list to your liking. Open it in your favorite text editor. Very near the top you will see two lists, each headed by a comment line. (These should stand out, since I rarely use them. I am a horrible, bad, evil programmer that way. :p )

Just change some of the items around. You can repeat items in the list, it won't hurt anything. I do not see why you would... But anyway.

Also, just a note: This scriptlet doesn't buy any more restorers. This is a use only scriptlet. (I wrote it primarily for myself, and I have a ton of different restorers when I pull everything out of Hagnks.)

On top of everything else, I could easily imagine 9 different people with 9 different preference lists... This was the best way to make it usable to the most amount of people.
 
Updated to use Maps.

This makes it a bit more versatile now.

While I have left it as it was originally, with only the 9 "most common" restorers of each type, you could easily increase the amount as much as desired.

Just remember, the lower numbers are considered "worse," while the higher numbers are considered "best."

I will remove the other instances of the file, and only have the most up to date version available.
 

Attachments

  • RestorerSelecterASH.ash
    2.7 KB · Views: 107
Top