Search the Community
Showing results for tags 'pascal'.
-
One thing I've noticed, is that there isn't much in the way of nice, easy to understand, and commented scripts for FO4Edit, which presents quite a big wall to lads who've never touched Pascal before. So what I've decided to do, is go through all of my scripts and add comments to them. So far, I've done four or five, and I'd like ta get the opinions of people who have never touched the stuff before. Some proper opinions 'n' criticism 'n' such. A super small & simple script with comments can be seen 'ere. And a relatively complex one here. Some feedback on stuff that still confuses ya 'n' such would be most welcome.
-
Hi, I was thinking of making a patch for Dragonborn Ascendent and a draugr overhaul I've been looking to play. For context, Drabonborn Ascendent buffs certain shouts in the game. It gives the vanilla draugr that use some of these shouts their own unique one since using the buffed shouts would be op (such as removing the level cap on disarm, seriously). Problem is though the draugr mod I have in mind has a whopping 253 npcs! That's obviously quite a few records to sort through by hand. So then I thought: why not make an xEdit script that can do this? Problem is, I've never looked into it before. I decided to look at my file for the spawn removal tool. Fortunately, I was able to open it in notepad++. Sadly though, its written in Pascal, a language I'm not familiar with (I mostly only have certificates in web development languages, the only 'programming' languages I know are python and c++, python being what I mostly work in). It looks nothing like what I'm used to, but scanning over it I think I'm starting to make sense of the code, even though I don't know what half its commands do. Doing so though, I realized that this specific file may not help me much. I need a program that can CHANGE records to something else (such as the newly added draugr shouts), while the spawn removal tool only removes them! Because of that, it doesn't contain a command I would need to do such. The command it uses to remove stuff from leveled lists is just a deletion command, which will clearly do me no good. I at least need something that lets me ADD actor effects to npcs. What I need wouldn't be too fancy. Simply, it would iterate over all the npc entries in a mod. Every time it finds an npc with either the frost breath or disarm shouts, it replaces those with the corresponding 'draugr' shouts from Dragonborn Ascendent. I would do it myself, but I don't know pascal, and scanning over the files I do have I don't see a command I could use to change actor effects. Honestly, if someone could tell me how to make this, it would be appreciated as much if not more as doing it for me. And yes, I even thought about trying to do this with SPID. Sadly, it seems to have no way to select npcs by the spells they already have. Fml...
-
I'm actually trying to merge the shell texturing of a cloth (which have fur, but is low-poly) and a high-poly cloth with NifSkope I know i can use TES5edit scripts to "mass edit" (batch process) meshes, so i was wondering if i could code something that copy it automatically. Basically i need to copy these Fur.00x branches and paste in the "Scene Root" of another NIF with the same name but in another folder Next image is the highpoly mentioned before No need to be a complicated code, i can figure out how to code it but i need somone to explain me the part to copy a specific branch inside scene root to another file
-
I'm having a hard time getting a script together that will both compile in Delphi's Starter IDE and run in FO4Edit. It's typically one or the other, due to enums. For example, I can operate on DefType or ElementType returns, and have created a script that runs correctly, but it raises compile errors in IDE, which makes it difficult to check other syntax errors I may be making while trying to learn the language. That's a general problem I'm having. (But maybe I can add 'wbDefinitionsFO4' from source to uses to compile, then remove? Idk.) Now I have a script which doesn't (yet) utilize those type returns and which does compile correctly but raises "Class declaration expected but '(' found", due to my apparently otherwise seemingly correct implementation of my own enumeration type, based off Delphi's online and TES5Edit's source examples. The TES5 Scripting Functions Wiki notes that the 'type' keyword is unsupported but it can be used to "alias a class name" (whatever that means). I don't know how to define this enumeration otherwise, or if I'm even allowed to use it within the confines of the API. (It's all magic and a bunch of := and ; but not += to me. Yeesh.) Anyway, I'm trying to write a script that will write a collection of records to json(s). In order to do that, I first want to remove the numbering from things like 'Value #1' and otherwise put elements that are described as arrays (in 'wbDefinitionsFO4') into arrays (because ElementType doesn't tell the whole story in that regard). This entails pre-compiling lists (or delimited strings) of Names for each record type to search against as I cycle through the container(s) in order to format the json correctly. To do the search, I thought I'd grab the signature of the record and run it through a case statement, so I know which particular strings to search for. Can't do that for strings, and I don't want to write a bunch of if else statements if I can help it. So I figured I'd change to signature to its unique integer and run it through a case of similarly pre-determined signature enum integers and fork from there. Smart? Idk.(A timeit test in Python showed that, even with conversion cost, 'int in [ints]' was 2x+ faster than 'string in [strings]'. Python doesn't have cases, and from the Wiki, Edits scripts don't support 'in'. Yeesh.) I can't get my script to run in Editor, let alone set up some bench comparisons. (It did work before I added the enum/case stuff, and output in same format as an xDump, since my Write functions are adapted directly from it.) Rant over. Code with snipped enum below. Any insight/guidance would be appreciated. Thanks! unit myEditScript; interface uses xEditAPI, Classes, SysUtils, StrUtils, Windows, Math; type TSig = ( _AACT = 65656784, _NPC_ = 78806795 ); // Global variables var List : TStringList; var aIndent : string; procedure WriteElement(e : IInterface; aIndent: string = ''); procedure WriteContainer(e : IInterface; aIndent: string = ''); function RemoveNumbering(str : string): string; function SigToTSig(SigStr: string): TSig; function SigSwitch(Sig: TSig): integer; implementation function RemoveNumbering(str : string): string; var i : integer; begin Result := ''; i := Pos(' #', str); if (i = 0) then Result := str else Result := copy(str, 1, i-1); end; //idk if this works yet, different than my Python test function function SigToTSig(SigStr: string): TSig; var i, ch, e, Sig : integer; begin e := 3; for i := 1 to 4 do ch := ord(SigStr[i]); Sig := Sig + Round(ch*IntPower(100,e)); e := e - 1; Result := TSig(Sig); end; function SigSwitch(Sig: TSig): integer; begin Result :=0; Case Sig of _NPC_: Result:=1; End; end; procedure WriteContainer(e : IInterface; aIndent: string = ''); var i : Integer; begin for i := 0 to Pred(ElementCount(e)) do WriteElement(ElementByIndex(e, i), aIndent); end; procedure WriteElement(e : IInterface; aIndent: string = ''); var Name : string; Value : string; Str : string; defTypeStr : string; eleTypeStr : string; SigStr : string; begin Name := ShortName(e); Value := GetEditValue(e); SigStr := Signature(e); //first if just a test to see if it will catch if (SigSwitch(SigToTSig(SigStr)) = 1) then List.Add('Match'); if (Name <> 'Unused') then begin if (Name <> '')then Str := aIndent + RemoveNumbering(Name); if (Name <> '') or (Value <> '') then aIndent := aIndent + ' '; if (Value <> '') then begin Str := Str +': ' + Value; List.Add(Str) end else begin if (Name <> '') then List.Add(Str) end; end; WriteContainer(e, aIndent); end; // Called when the script starts function Initialize : integer; begin List := TStringList.Create; end; // Called for each selected record in the TES5Edit tree // If an entire plugin is selected then all records in the plugin will be processed function Process(e : IInterface) : integer; begin aIndent := ''; WriteContainer(e, aIndent); end; // Called after the script has finished processing every record function Finalize : integer; var filename : string; begin filename := ProgramPath + 'Edit Scripts\Test.txt'; AddMessage('Saving to ' + filename); List.SaveToFile(filename); List.Free; end; end.