DiggyDuggy Posted January 29, 2022 Share Posted January 29, 2022 (edited) Hello there! I'm working on a script to track Pokémon's progress from a save file. I'm not very knowledgeable about save file manipulation, but PKHeX already does it extremely well. Is there any way to use some of the multiple functions PKHeX has using the command line? Specifically dumping all of the boxes a save file has to a .bp8 format or adding .bp8 files into the save? I know you can do this already using the regular program, but is any way of doing this using the command line? I'm new to the community, so I'm sorry if I'm doing something out of line. Thanks to everyone who reads this in advance! Edit: if there's a more straightforward method you know of that doesn't make use PKHeX, please let me know as well! Edited January 30, 2022 by DiggyDuggy Link to comment Share on other sites More sharing options...
Kaphotics Posted January 30, 2022 Share Posted January 30, 2022 PKHeX is open source, and is split up into separate projects to produce .dll files with non-visual logic residing in PKHeX.Core https://github.com/kwsch/PKHeX PKHeX.Core is available on NuGet. https://www.nuget.org/packages/PKHeX.Core/ You can reference the dll/nuget in whatever script, and call whatever functions you want. LINQPad is pretty useful for this, if the scripts are small in scope. PKHeX also supports custom plugins, so you can write your own code to be triggered via the main GUI, which is easier if you want to share your custom scripts with less capable users. 1 Link to comment Share on other sites More sharing options...
DiggyDuggy Posted January 30, 2022 Author Share Posted January 30, 2022 4 hours ago, Kaphotics said: PKHeX.Core is available on NuGet. https://www.nuget.org/packages/PKHeX.Core/ You can reference the dll/nuget in whatever script, and call whatever functions you want. That's certainly a start, thank you! I've certainly given a look to the PKHeX.Core from the official GitHub page before, but I don't understand one thing, hahah.  Is there any documentation to use as reference? I can't find any. Link to comment Share on other sites More sharing options...
Kaphotics Posted January 31, 2022 Share Posted January 31, 2022 string path = @"E:\mysavefile.sav"; var sav = SaveUtil.GetVariantSAV(path); var all = sav.BoxData; var pathPB7 = @"E:\poke.pb7"; var dataPB7 = File.ReadAllBytes(pathPB7); var pb7 = new PB7(dataPB7); all[0] = pb7; sav.BoxData = all; File.WriteAllBytes(path, sav.Write()); Example linqpad script attached; you have to press F4 and add the DLL path, and add the using namespace. 2 Link to comment Share on other sites More sharing options...
DiggyDuggy Posted January 31, 2022 Author Share Posted January 31, 2022 Wow, that is EXTREMELY useful! Seriously thank you very much! I'll give this a try once I figure out how to set the environment. Seriously thank you! Link to comment Share on other sites More sharing options...
DiggyDuggy Posted January 31, 2022 Author Share Posted January 31, 2022 1 hour ago, Kaphotics said: string path = @"E:\mysavefile.sav"; var sav = SaveUtil.GetVariantSAV(path); var all = sav.BoxData; var pathPB7 = @"E:\poke.pb7"; var dataPB7 = File.ReadAllBytes(pathPB7); var pb7 = new PB7(dataPB7); all[0] = pb7; sav.BoxData = all; File.WriteAllBytes(path, sav.Write()); Example linqpad script attached; you have to press F4 and add the DLL path, and add the using namespace. Okay so I tried using your code with Visual Studio and it works! It loads a Pokémon file and puts it into a save data's first Box slot. This was really helpful as a first step, thank you! Next step would be to figure out how to read the Pokémon's data in human language. Now I need to read all of the PKHeX.Core functions to try and understand what tools I have at my disposal. It's probably going to take a while. But seriously, I can't thank you enough! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now