0 of 0

File information

Last updated

Original upload

Created by

Bla159

Uploaded by

ZeadMassani

Virus scan

Safe to use

Tags for this mod

About this mod

From FO4Edit to CSV to XML to RobcoPatcher

Requirements
Permissions and credits
Donations
A easy Way to export whole Plugins directly into RobcoPatcher Leveled Lists

Perfect if you want to do complete Overhauls 

Step One: Apply Script for CSV:

Apply this Script in FO4edit on the Records you want to apply:

{
  Export list of records
}
unit UserScript;
const
  // skip those records
  sRecordsToSkip = 'REFR,PGRD,PHZD,ACHR,NAVM,NAVI,LAND';
var
  slExport: TStringList;
function Initialize: integer;
begin
  slExport := TStringList.Create;
end;
function Process(e: IInterface): integer;
begin
  if Pos(Signature(e), sRecordsToSkip) <> 0 then
    Exit;
  slExport.Add(
    GetFileName(e) + ';' +
    IntToHex(FormID(e) and $FFFFFF, 8) + ';' +
    Signature(e) + ';' +
    EditorID(e) + ';' +
    GetElementEditValues(e, 'FULL')
  );
end;
function Finalize: integer;
var
  dlgSave: TSaveDialog;
  ExportFileName: string;
begin
  if slExport.Count <> 0 then begin
    dlgSave := TSaveDialog.Create(nil);
    try
      dlgSave.Options := dlgSave.Options + [ofOverwritePrompt];
      dlgSave.Filter := 'Excel (*.csv)|*.csv';
      dlgSave.InitialDir := ScriptsPath;
      dlgSave.FileName := 'Records list.csv';
      if dlgSave.Execute then begin
        ExportFileName := dlgSave.FileName;
        AddMessage('Saving ' + ExportFileName);
        slExport.SaveToFile(ExportFileName);
      end;
    finally
      dlgSave.Free;
    end;
  end;
  slExport.Free;
end;
end.


Then you will get a CSV file, then you will convert it into a xml with something like this: https://www.freeconvert.com/csv-to-xml

At last you will use this Script (Its Python, so downlaod something simple like Thonny)

import xml.etree.ElementTree as ET
import os
# Path to the XML file
xml_file = "C:\\Users\\example\\Downloads\\Records list3.xml"
# Check if the file exists
if not os.path.exists(xml_file):
    print("❌ Error: XML file not found!")
    exit()
# Parse the XML file
tree = ET.parse(xml_file)
root = tree.getroot()
# Extract all <text:p> entries (explicitly specifying the namespace)
text_entries = [elem.text for elem in root.findall(".//{urn:oasis:names:tc:opendocument:xmlns:text:1.0}p") if elem.text]
# Debug: Check how many <text:p> elements were found
print(f"Number of <text:p> elements found: {len(text_entries)}")
# Remove unwanted entries like "Page"
filtered_entries = [entry for entry in text_entries if ";" in entry]
# If no valid entries were found, exit
if not filtered_entries:
    print("❌ No valid data found!")
    exit()
# List to store the formatted lines
output_lines = []
# Convert the data into the desired format
for entry in filtered_entries:
    values = entry.split(";")  # Split entries into individual values
    if len(values) < 4:
        continue  # Skip if there are not enough values
    first_value, second_value, _, fourth_value = values[:4]
    output_lines.append("//*************************")
    output_lines.append(f"//*** Level 1; {fourth_value}; {first_value} ")
    output_lines.append("//*************************")
    output_lines.append("//LL_Armor_Piecemeal_Helmets [LVLI:001A72C9]")
    output_lines.append(f"//filterByLLs= Fallout4.esm|001A72C9:addToLLs={first_value}|{second_value}~1~1~0 ")
    output_lines.append(f"filterByArmors={first_value}|{second_value}:damageResist=1\n")
# Save the formatted data to a file
output_file = "C:\\Users\\example\\Downloads\\formatted_output.txt"
with open(output_file, "w", encoding="utf-8") as file:
    file.write("\n".join(output_lines))
print(f"✅ File saved: {output_file}")


At last you will have a txt file which contains: The level, the Modname, the integrated leveled list and armor modificator. So you can simply convert 100s of armor/weapon records into RobcoPatcher INIs like this below:

//*************************
//*** Level 1; TNGR_Armor_GodSaveTheQueen; GreaseRatGarbs.esp 
//*************************
//LL_Armor_Piecemeal_Helmets [LVLI:001A72C9]
//filterByLLs= Fallout4.esm|001A72C9:addToLLs=GreaseRatGarbs.esp|0001195C~1~1~0 
filterByArmors=GreaseRatGarbs.esp|0001195C:damageResist=1

If you need help write a comment!

I hope it makes your patching a lot faster too.

I found a lot of the code in the Internet, if you need to be creditet writ me!