Presto Ragu
Member
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:
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:
or
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.)
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")
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.)