extraction.ash - Automated Gene Extraction

digitrev

Member
WARNING: Only some initial testing has been done.

So, because I'm a giant nerd, I thought it'd be fun to write some code to automagically handle the Gene splicing kit. Attached are the post-adventure potion creation & hybridization code, and a Custom Combat Script. If you take a look at extraction.ash, you can set up the recommended aliases.

I've created a new file called extractCCS.ash. This will handle the use of the DNA syringe. Just add consult extractCCS.ash to your custom combat script for all your auto-extraction needs.

Install with svn checkout svn checkout https://svn.code.sf.net/p/digitrev/code/extraction

Also hopefully getting included in the Script Manager.

Questions? Comments? Concerns?


r2 - Moved everything to sourceforge
0.7 - Moved everything over to svn.
0.6 - Fixed extraction.ash to verify if there actually is DNA in the syringe before doing anything. Also re-included import <zlib.ash> so that list_contains can be accessed.
0.5.1 - Put back in zlib.ash to fix a stupid error.
0.5 - Removed dependencies on SS, WHAM, and BB.
0.4 - Added extractCCS.ash.
0.3 - Changed some old code that was allowing the DNA syringe to be used even when it already had the phlyum DNA of the monster you're facing.
0.2 - I seem to have it working. Took away the .patch files, since those seemed extraneous.
0.121 - Removed an extraneous line of code from SmartStasis.ash.
0.12 - Removed '_' from '_dnaSyringe' to account for r13916.
0.11 - Fixing some really egregious errors in extraction.ash. It should now be able to handle spaces after the comma.
0.1 - Initial version
 
Last edited:

digitrev

Member
Setup

First off, install the code. Both files go in the scripts/ folder. Then, you'll want to setup these aliases:
Code:
alias extract_gene => ashq if ($string[%%].length() != 0) {if ($string[%%] == "none") {set_property("autoExtractGene", "");} else {set_property("autoExtractGene",$string[%%]);}} else {print(get_property("autoExtractGene"));}
alias extract_hybrid => ashq if ($string[%%].length() != 0) {if ($string[%%] == "none"){set_property("autoExtractHybrid", "");} else {set_property("autoExtractHybrid",$string[%%]);}} else {print(get_property("autoExtractHybrid"));}

Then do set afterAdventureScript=extraction.ash.

You'll want to make sure that extractCCS.ash is consulted during your combat script, preferably before you kill the monster.

Usage

Here's how it works. Once the autoExtractGene or autoExtractHybrid properties have been set, SmartStasis will compare them with the phylum of the monster you're fighting, and if you have a DNA extraction syringe, it will use it during the combat. Then, after combat ends, extraction.ash will create the appropriate potions and then hybridize yourself if you've asked for it. It will then remove any copies of that phylum from both lists.

If you want to automatically hybridize yourself with the first weird phylum you come across, you type extract_hybrid weird. Or if you want to automatically create a Gene Tonic: Goblin from the first goblin you see, type extract_gene goblin.

But that's not all. Let's say you want to extract 2 orc tonics and 1 hobo tonic. Just type extract_gene orc, orc, hobo, and if you find a hobo, it will create on potion, followed by 2 potions if you run across an orc. The same applies for extract_hybrid. You can pass along a comma separated list and it will hybridize the first thing it sees.


Some caveats

If you pass along more than one phylum to extract_hybrid, it will only remove one phylum upon hybridization, and so it will try to hybridize the next day with the remaining phylum. I might try to set up some sort of priority system in the future (where you can tell it you're happy with any of phyla x, y, and z, but if you get x then remove y & z, or if you get y then remove z), but for now, be wary.

Similarly, if you tell it to create more than 3 gene tonics, it will save the rest for the next day.
 
Last edited:

digitrev

Member
Right, so I'm having some trouble getting SmartStasis.ash to properly use the syringe. I hope to have a fix by the end of the day, but I'll be damned if I can figure out why it won't work.
 

Winterbay

Active member
Right, so I'm having some Is SmartStasis.ash to properly use the syringe. I hope to have a fix by the end of the day, but I'll be damned if I can figure out why it won't work.

Is the syringe in batfactors? If it isn't batbrain won't do anything.
 

digitrev

Member
It is now. I ran out of adventures after giving up on this for a while, so I'll try and test it properly tomorrow.
 

Bale

Minion
It is now. I ran out of adventures after giving up on this for a while, so I'll try and test it properly tomorrow.

[sarcasm] Thank you so much for fucking me up! [/sarcasm]

What you did was to tell BatBrain that the DNA extraction syringe is the world's best stasis item. You needed to add the keyword "custom" to let BatBrain know not to use it without specific instructions. (The keyword "once" would also have been appropriate.) The syringe even staggers the enemy so they cannot attack while you stasis them. An item like that would be amazingly awesome if it really existed. I fixed it so that it won't cause trouble for anyone else.

Fortunately I wasn't hurt too bad by losing my previous DNA sample so I don't hate you for it, but you need to pay attention when you add an item to batfactors without any cost.
 
Last edited:

digitrev

Member
[sarcasm] Thank you so much for fucking me up! [/sarcasm]

What you did was to tell BatBrain that the DNA extraction syringe is the world's best stasis item. You needed to add the keyword "custom" to let BatBrain know not to use it without specific instructions. (The keyword "once" would also have been appropriate.) The syringe even staggers the enemy so they cannot attack while you stasis them. An item like that would be amazingly awesome if it really existed. I fixed it so that it won't cause trouble for anyone else.

Fortunately I wasn't hurt too bad by losing my previous DNA sample so I don't hate you for it, but you need to pay attention when you add an item to batfactors without any cost.

Oh, jeez, I'm sorry. I will make sure to test things before I do that in the future. My mistake.
 
Hey, this sounds cool but i can't get it to work. The post adventure script works- if I manually use a syringe on a monster... How do I make batbrain allow use of the syringe?
 

digitrev

Member
Yeah, I haven't got around to doing anything with this. I might have time this weekend to play around with BatBrain to see if I can automate the extraction.
 

digitrev

Member
Right, so I've made the last change that I needed to make (I think), and now it should work properly. For what it's worth, you also have to add a line to batfactors.txt, but until someone gives me the go ahead, I won't be pushing this to the map manager yet.
Code:
item	7383	DNA extraction syringe	0	0	stun 1, once, custom
 
I'm having problems getting this to work. I did the updates, and set the preferences, and for awhile yesterday, I saw SS use the extractor, but I only got 1 demon tonic all day (day 2 normal rains). today I ran into fish and nothing. is there something that i'm not getting? thanks.
 

digitrev

Member
Well, if you ran into a freshwater bonefish or a piranhadon, Mafia doesn't yet know that their phylum is fish. I'll add these to the appropriate thread.
 
Then don't forget the alley catfish either. :) New batbrain yesterday overwrote should_extract, which I replaced, but if there was anything else, my diff-fu couldn't find it.
 

digitrev

Member
That's the only change made to batbrain. It's SmartStasis that has the code that actually does the thing. Shit. There's also another thing that I changed for myself (since I didn't think anyone was actually using it). It'll only trigger a problem rarely, but make sure that you change "_dnaSyrine" to "dnaSyringe" on line 141. I'll make the changes to my code up above.

Those changes have now been made.
 
Last edited:

digitrev

Member
I hate double posting, but I've updated this so that you should no longer actually need to edit SmartStasis or BatBrain in order to auto-extract DNA.
 
Two things. First, I don't know if you noticed, but the last two updates to batbrain have required adding should_extract.

Second, I came up with this, that I think is working *for me* to do 2/3 day normal runs. I call it during login.
Code:
void dnastuff() {
if (item_amount($item[dna extraction syringe]) > 0) {
  switch(my_daycount()) {
    case 1  : cli_execute("extract_hybrid wierd"); 
              cli_execute("extract_gene bug, dude, humanoid"); 
              break;
    case 2  : cli_execute("extract_hybrid fish");
              cli_execute("extract_gene elemental, constellation, construct"); 
              break;
    default : cli_execute("extract_hybrid pirate");
             cli_execute("extract_gene penguin, orc, mer-kin"); 
             break;
    }
  }
}
 
Last edited:

digitrev

Member
Yeah, sorry about that. I've rewritten it so that it doesn't need to go in SS or WHAM. I'll update the main post shortly.

Edit: The main post has been updated.
 
Last edited:
I think part of the problem sometimes is smart stasis doesn't want to use the syringe because it's afraid I'll get hit, which I probably will, but by the time I'm done delevelling with thunder bird, weaksauce, pocket crumbs, and generate 3 momentum, it doesn't matter anymore. That's not a criticism of this script or smart stasis, just an observation. There may be a setting I can change, I don't know.

That said, I successfully hybridized and collected all 3 of my gene specimens for day 1 using my new function. So I'm happy happy.
 

digitrev

Member
I think part of the problem sometimes is smart stasis doesn't want to use the syringe because it's afraid I'll get hit, which I probably will, but by the time I'm done delevelling with thunder bird, weaksauce, pocket crumbs, and generate 3 momentum, it doesn't matter anymore. That's not a criticism of this script or smart stasis, just an observation. There may be a setting I can change, I don't know.
That's certainly a possibility. It seems unlikely (since stagger resistance doesn't kick in until +151 ML). I suppose I could add a check in extractionCCS.ash, or an option to decide if you're okay with possibly getting hit while using the DNA syringe.

That said, I successfully hybridized and collected all 3 of my gene specimens for day 1 using my new function. So I'm happy happy.

Glad to hear that it worked for you. Definitely a good idea to drop it into your login/breakfast script.
 
Top