Jump to content

[JSON / Papyrus] Search JSON files for Form?


Recommended Posts

Hi, sorry, new to JSON files...

 

I am currently changing my mod from using ESP/savegame based Formlists to external JSON files.

What I forgot is, that I need a way to find a Form in a list very fast (many lists to search).

 

So I have Form akBaseObject

and used this:

 

Formlist01.HasForm(akBaseObject) || Formlist02.HasForm(akBaseObject) || .... etc

 

to return true or false (all I need. basically is Armor Y (Form) in one of these 10 json files with Armor Forms or not?

 

Is there something similar for JSON files, maybe even a 1:1 equivalent? I tried parsing the scripts, but no idea which one of those would be right...

Or do I have to load all the forms first from the json into my script and then compare them all 1 by 1? 

 

thx alot... 

 

Edited by Nymra
Link to comment

There is no easy way to do a contains on a json file that checks for two different values (mod file name and form id) unless you do some funky string combination like "MyMod.esp|0x00ABCDEF". The fastest would probably be to load all the .json files into arrays on game load and then do a find operation on the array.

Link to comment
8 minutes ago, VersuchDrei said:

There is no easy way to do a contains on a json file that checks for two different values (mod file name and form id) unless you do some funky string combination like "MyMod.esp|0x00ABCDEF". The fastest would probably be to load all the .json files into arrays on game load and then do a find operation on the array.

 

yeah, was afraid so..... maybe I just keep the Formlists in the background then... save Armor Outfits to external files and formlists at the same time, one for the player to keep outfits across saves and profiles and one for internal use... hmm.

 

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use