pra Posted July 4, 2017 Share Posted July 4, 2017 I just tried making my own settler renaming mod. It's mostly done, except for one minor detail: the actual names. I'm absolutely not going to manually create 100 or so MESGs. I've also seen that F4Edit is scriptable, though it's absolutely undocumented. From the examples there I could tell that it is at least capable of copying records of an ESP and writing and probably reading files.I think it should be possible to script it in such a way that it takes a file with several names, and then just keeps copying the same MESG record over and over with a new string. Has anyone here tried something like this? Or, is there an actual documentation of f4edit somewhere? Link to comment Share on other sites More sharing options...
FiftyTifty Posted July 4, 2017 Share Posted July 4, 2017 Function documentation: http://www.creationkit.com/index.php?title=TES5Edit_Scripting_Functions How I'd tackle the script: Create text file of all the namesLoad text file into a TStringsList variableUse a for loop to run through the TStringsList, pulling a name from it after each iterationInside for loop, duplicate selected record by calling wbCopyElementToFile()Inside for loop, change duplicated record's data This is very simple. Would only take, like, 10-15 lines of actual code. Link to comment Share on other sites More sharing options...
stonefisher Posted July 5, 2017 Share Posted July 5, 2017 I Use a mouse click macro program.Just set things out so it cuts and pastes and have everything spaced nicely on your screens and click loop macro. Link to comment Share on other sites More sharing options...
pra Posted July 5, 2017 Author Share Posted July 5, 2017 Function documentation: http://www.creationkit.com/index.php?title=TES5Edit_Scripting_Functions How I'd tackle the script: Create text file of all the namesLoad text file into a TStringsList variableUse a for loop to run through the TStringsList, pulling a name from it after each iterationInside for loop, duplicate selected record by calling wbCopyElementToFile()Inside for loop, change duplicated record's data This is very simple. Would only take, like, 10-15 lines of actual code.Oh. I was searching for f4edit, had no idea that I was supposed to look for TES5Edit. Thank you! Link to comment Share on other sites More sharing options...
pra Posted July 5, 2017 Author Share Posted July 5, 2017 I did it. The script isn't too clean and the file selection part is shamelessly stolen from another, but in case someone wants to do something similar, here it is: unit BatchCreate; var ToFile: IInterface; function Process(e: IInterface): integer; var i: integer; frm: TForm; clb: TCheckListBox; nameList: TStringList; newElem: IInterface; suffix: String; begin if Signature(e) = 'TES4' then Exit; nameList := TStringList.Create; nameList.loadFromFile('d:\names\f4names-m.txt'); suffix := 'm'; if not Assigned(ToFile) then begin frm := frmFileSelect; try frm.Caption := 'Select a plugin'; clb := TCheckListBox(frm.FindComponent('CheckListBox1')); clb.Items.Add('<new file>'); for i := Pred(FileCount) downto 0 do if GetFileName(e) <> GetFileName(FileByIndex(i)) then clb.Items.InsertObject(1, GetFileName(FileByIndex(i)), FileByIndex(i)) else Break; if frm.ShowModal <> mrOk then begin Result := 1; Exit; end; for i := 0 to Pred(clb.Items.Count) do if clb.Checked[i] then begin if i = 0 then ToFile := AddNewFile else ToFile := ObjectToElement(clb.Items.Objects[i]); Break; end; finally frm.Free; end; if not Assigned(ToFile) then begin Result := 1; Exit; end; end; AddMessage(GetElementEditValues(e, 'FULL')); for i := 0 to nameList.count-1 do begin AddMessage(nameList[i]); newElem := wbCopyElementToFile(e, ToFile, True, True); SetElementEditValues(newElem, 'FULL', nameList[i]); SetElementEditValues(newElem, 'EDID', 'baseName_'+suffix+IntToStr(i)); end nameList.free(); end; end. Link to comment Share on other sites More sharing options...
Recommended Posts