If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Alchemy Script of Doom!!!1!one

The alchemy script is getting to be near complete. The old alchemy script has been renamed to alchemy-old on the repository, and alchemy-new is renamed to just alchemy.

How the script works:

Everything is a recipe. In addition to the 190 recipes that give ranks, there are 428 support recipes. Many of these are one-step recipes for buying, foraging, grinding, extracting, distilling, or killing (either for skins or things like essence of fire).

The script makes recipes recursively. When it can't find an ingredient on you, it looks for recipes to make that ingredient. For example, if a recipe requires ground tkaro and you don't have any, it will find the recipe for making ground tkaro, which requires tkaro root. If you don't have any tkaro root, it looks for a recipe for tkaro root, which is a simple forage recipe. Or, if you're making something that requires an ayanad crystal, and you only have a n'ayanad crystal, it will break the n'ayanad crystal down into a t'ayanad crystal, s'ayanad crystal, and two ayanad crystals, and then do the original recipe.

The script attempts to find cheapest/fastest combination of recipes to do a task. The estimated cost is the cost of whatever needs to be bought, plus the cost of the pawnshop-style ingredients at the alchemist. If you have an ingredient on you, its cost is zero, unless it's a pawnshop-style ingredient. The time estimate includes travel time to and from forage locations, hunting grounds, and shops, the roundtime for all the alchemy commands, and an estimated time needed to forage or hunt.

The script learns how long it takes you to forage or hunt for each ingredient by keeping track of the total time spent foraging or hunting, and the total number of ingredients found for each ingredient. By default, everything is set to 1 second and 1 ingredient, which encourages the script to try new things and find out what is really the fastest.

The cost-per-second setting is used to combine the estimated cost and time into a value it can compare against other recipes to pick the best recipe (;alchemy set cost-per-second 15). The default value is 15, meaning the script would rather spend 899 silvers to buy an ingredient than spend 60 seconds foraging or hunting for it, and it would rather spend 60 seconds foraging or hunting than spend 901 silvers to buy.

How to get started:

The script does not buy alchemy equipment. So if you haven't already, go buy a cauldron, mortar, pestle (put the pestle inside the mortar), small crystal flask, and (clouded|warped|chipped|tapered|smoky|thick|slende r) glass vial. Also, get a large bank note and put it in one of your containers.

The script will look in all three containers for anything it needs. It will put away herbs in your herbsack; alchemy equipment, reagents, and bank notes in your alchemysack; and alchemy products that can't be used as an ingredient in your lootsack.

If you want the script to collect skins or hunt for other ingredients, you need to set up an attack script (;alchemy set attack-script <scriptname>). The attack script is given the ids of any npcs in the room that are supposed to have the ingredient you're looking for. The attack script needs to kill them, handle looting, and exit. There are a couple global variables that the attack script can set.

$alchemy_abort_room = true

If the attack script does this, the alchemy script will ignore any npcs in the room and move to the next.

$alchemy_abort_hunt = true

If the attack script does this, the alchemy script will end the hunt.

You can also set before-hunt-script, after-hunt-script, before-forage-script, and after-forage-script.

;alchemy need – This finds every ingredient that can be used in any recipe you can get ranks for, and creates a regex that can be accessed with UserVars.needed_reagents or viewed with “;set list”. This regex is used by loot-be-gone to automatically exclude reagents you need from being sold, and by “;alchemy buy” to know what to buy.

;alchemy buy – This buys pawnshop-style reagents from the alchemist. It buys at most 20 of each reagent you need and puts them in jars if you have them.

If you're using “;alchemy auto”, then needed_reagents is automatically set if it's missing and each time the script gains a ranks for you.

What's left to do:

Many recipes are untested. There are likely errors and typos somewhere. Some recipes did not have the last rank it would give ranks on virilneus.com and krakiipedia.com. Pretty much any recipe with a range of 10 ranks is not correct.

The script knows that it should forage every ingredient that is foragable, and it knows what npc to kill for every skin, but it doesn't necessarily know where to find those things. It relies on tags in the map database. Likewise, it knows the full inventory for every guild shop. It knows if something is only available in certain towns and/or to certain professions. However, it doesn't know where every guild shop is, or every training cauldron, workshop, training administrator, etc. until the map database is fixed up.

Refract code was added, but not really tested. Also, I had to guess which time you can refract sunlight and moonlight.

The buy-crap, throw-away-crap, and sell-crap settings are only used in auto mode. Use throw-away-crap and sell-crap at your own risk. They pretty much only throw away and sell the stuff I needed them to, and it's possible it'll throw away something you don't want it to. It could be fixed up slightly by editing the script, but I plan on moving this function out of the alchemy script and into loot-be-gone.

If the script doesn't work in the town you want, here's how to fix it.

First, the guild probably needs to be mapped or remapped. If you're not sure if your guild has been mapped properly, go to the training administrator and type:

Code:

;e echo Room.current.location

If that doesn't echo your town name, it needs to be mapped. See the lrn2map thread on how to do that. You should have a training cauldron task when mapping the guild, otherwise they won't let you in there while mapping and the alchemy script won't know where it is when you get the task.

Then, several rooms need tags added to them.

<profession> alchemy administrator
The place where you get new tasks.
<profession> alchemy guildmaster
The place where you get promoted
<profession> alchemy cleaning supplies
The place where you get a cleaning rag, broom, and dust pan.
<profession> alchemy masters
The place where you ask a guild master about training.
<profession> alchemy training cauldron
The place with the training cauldron. That is, the room you end up in after typing "go cauldrons"
<profession> alchemy workshop
Each of the alchemy workshops that have a crucible, assembly, and such.
<profession> alchemy shop
The place where you buy cauldrons and things.
<town> <profession> alchemy shop
Same room as <profession> alchemy shop.

alchemy sea water
This is where you fill a flask with sea water. It is already set for Wehnimer's and Teras. I don't know where the room is in any other towns.

trash
This is used in auto mode if you use the throw-away-crap setting. Mostly prevents the buildup of ground herbs and tinctures.

reagent shop
This is the room next to the consignment room where you buy reagents pawnshop-style. I'm not sure if any towns are missing it.

The lrn2map thread tells how to add tags. You might want to type:

Code:

;e echo Room.current.tags

to make sure you're not adding a that that's already there.

If you have to map your guild, you can add the tags directly to the map database before you send it to me. If you didn't have to map your guild, you can just post the name of the tag, the room number, and the game instance it's for in the lrn2map thread and it'll get added before the next upload.