File information

Last updated

Original upload

Created by

COACHWICKWACK

Uploaded by

Beefclot

Virus scan

Safe to use

About this mod

This script bundle includes 5 xEdit scripts intended to make development/modding easier.

Requirements
Permissions and credits
Changelogs
Donations
COACH's Awesome Sauce Scripting Power Pack (xEdit)(now it's more epic with v2)
Installation
Extract the scripts into your xEdit/Edit Scripts folder.

Purpose
I wrote a bunch of xEdit scripts more than a few months ago intended to make modding/development easier. They do.

Features
AllConditionsMatchFilter.pas
  • Filter all records using a UI and optional Regex match on any element(s) found in filtered records.
  • Has checkboxes for all possible filter options that xEdit allows with right click > Apply Filter.
  • Only filter records that match ALL specified element paths/targets.

AllConditionsMatchSearch.pas
  • Search for one or more elements in any select records with optional Regex matching.
  • Optionally continue a search for a different path if the first path is found or Regex matched.
  • Optionally output all found/Regex matched records to a .json file for alternative processing/analysis
  • Only ouput records that match ALL specified element paths/targets or the console.

AnyConditionsMatchSearch.pas

  • Search for one or more elements in any select records with optional Regex matching.
  • Optionally continue a search for a different path if the first path is found or Regex matched.
  • Optionally output any found/Regex matched records to a .json file for alternative processing/analysis
  • Only output records that match ANY specified element paths/targets to JSON or the console.

AnyConditionsMatchReplace.pas
  • Replace one or more elements in any searched and found/Regex matched in any record.
  • Optionally continue a search for a different path if the first path is found or Regex matched.
  • Optionally output any found/Regex matched records to a .json file for alternative processing/analysis
  • Outputs elements changed that match ANY specified element paths/targets to JSON or the console.
ElementPathMatchModifier.pas
  • Search for one or more elements in any select records with optional Regex matching.
  • Optionally continue a search for a different path if the first path is found or Regex matched.
  • Add/remove elements in a record if given elements are found/Regex matched.


HOW TO USE:
Build a query path to search for any element in arrays or lists using /[*]/
Looking at elements in arrays requires using zero-indexing.


Example: "KWDA/[*]" will look for at each Keyword under KWDA - Keywords (sorted) for Weapons, Armors, or whatever record has that subrecord.
"KWDA - Keywords/[*]" also works

Example 2: "VMAD/Aliases/[*]/Alias Scripts/[*]/Properties/[*]/propertyName" will look at all aliases, alias scripts, properties, and all propertyNames for something like Quests, or whatever has that subrecord.

Example 3: "EDID" will look at the editor ID of selected records. If you want to look at the first base effect of any selected ingredient records, use "Effects/[0]/EFID".

These scripts let you use Regex matching. Here is a handy tool to practice reading/writing Regex to filter strings: regex101: build, test, and debug regex


I'm pretty busy between working on Somnium and work, but I can create a tutorial for using these scripts if there's interest.

Big thanks to everyone for helping me learn xEdit scripting:
mator (m8r98a4f2) for writing mteFunctions. I used a lot of his functions to practice.
fire and zilav for answering epic technical questions
ElminsterAU for recommending JsonDataObjects
jonathanostrus (Jonathan)


OLD DESC:

Spoiler:  
Show
Why I did it:
I wanted to write a couple scripts like this while working on Somnium because one of our modded NPCs wasn't acting hostile to the player. We narrowed it down to a faction collision, where the player is assigned to two Factions: PlayerFaction and PlayerAlliesFaction. The modded NPC considered PlayerFaction as an Enemy, whereas it considered PlayerAlliesFaction as a Friend. The Friend relation overrides the enemy relation, so the modded NPC was friendly until we changed PlayerAlliesFaction to Neutral. We could've removed the player from the PlayerAlliesFaction, but we didn't want to break any weird mechanics in the game.

Problems/Solutions/Use cases

  • Problem: I have a modded NPC and my Player that are related to each other via Faction relations, and my modlist has hundreds of mods with hundreds of factions. I want to have my modded NPC be hostile to the player, but for some reason faction relations aren't working as intended.
  • Solution: Use ElementDataExtractor to write a JSON of every FACT record in the game, and use whatever language you want to process the JSON and find the collisions in faction relations between the modded NPC and the player. Alternatively, do a regex match on every faction with an XNAM entry for "PlayerFaction" and write to JSON for manual debug.

  • Problem: I updated a property name in a script that affects several objects/records, and I need to rename the property in xEdit. I don't want to write a custom script to do this one-time, hardcoded search and replace. I also want to replace the script name.
  • Solution: Use ElementDataReplacer to search the generic element path with a regex value match for that property. If I leave the target element path blank, my script will use the query path as the replacement path. I will use my replacement values (the property and script name) to rename my property and script name in my selected records.



First, I use ElementDataExtractor to check my element paths are valid:

Then, I fill out the fields for each replace operation happening on my selected records:

Finally, I get the result:

Big thanks to everyone for helping me learn xEdit scripting:
  • mator for writing mteFunctions. I used a lot of his functions to practice.
  • fire and zilav for answering epic technical questions
  • ElminsterAU for recommending JsonDataObjects
  • m8r98a4f2
  • jonathanostrus
  翻译: