{ Export cloud textures from weather records Supports all games (Skyrim, Oblivion, Fallout 3 and New Vegas) } unit ExportWeatherCloudsTextures; var slCloud, slList: TStringList; function Initialize: integer; var i: integer; s: string; begin slCloud := TStringList.Create; // game specific cloud layers if wbGameMode = gmTES5 then slCloud.Commatext := '00TX,10TX,20TX,30TX,40TX,50TX,60TX,70TX,80TX,90TX,:0TX,;0TX,<0TX,=0TX,>0TX,?0TX,@0TX,A0TX,B0TX,C0TX,D0TX,E0TX,F0TX,G0TX,H0TX,I0TX,J0TX,K0TX,L0TX' else if (wbGameMode = gmFO3) or (wbGameMode = gmFNV) then slCloud.Commatext := 'DNAM,CNAM,ANAM,BNAM' else if wbGameMode = gmTES4 then slCloud.Commatext := 'CNAM,DNAM'; slList := TStringList.Create; s := 'Plugin;FormID;EditorID'; for i := 0 to slCloud.Count - 1 do s := s + ';' + 'Layer ' + IntToStr(i); slList.Add(s); end; function Process(e: IInterface): integer; var i: integer; DisabledClouds: LongWord; line, s: string; begin if Signature(e) <> 'WTHR' then Exit; // process each weather record only once for the last winning override if not IsMaster(e) then Exit else e := WinningOverride(e); // plugin name, formid, editorid at the start of each line line := GetFileName(e) + ';[' + IntToHex(FormID(e), 8) + '];' + EditorID(e); for i := 0 to slCloud.Count - 1 do begin s := GetElementEditValues(e, slCloud[i]); // no texture if a cloud layer is disabled in Skyrim if wbGameMode = gmTES5 then begin DisabledClouds := GetElementNativeValues(e, 'NAM1'); if DisabledClouds and (1 shl i) <> 0 then s := ''; end; line := line + ';' + s; end; slList.Add(line); end; function Finalize: integer; var dlgSave: TSaveDialog; begin if slList.Count > 1 then begin dlgSave := TSaveDialog.Create(nil); try dlgSave.Options := dlgSave.Options + [ofOverwritePrompt]; dlgSave.Filter := 'Excel (*.csv)|*.csv'; dlgSave.InitialDir := ScriptsPath; dlgSave.FileName := 'Clouds.csv'; if dlgSave.Execute then begin AddMessage('Saving ' + dlgSave.FileName); slList.SaveToFile(dlgSave.FileName); end; finally dlgSave.Free; end; end; slList.Free; slCloud.Free; end; end.