Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bugs and additional functions #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 53 additions & 5 deletions Edit Scripts/Restore record names from master.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
function Process(e: IInterface): integer;
var
m: IInterface;
mode: Char;
begin
// if U want only test (withoult apllying changes) set variable as 'test':
mode:= 'test';
if not ElementExists(e, 'FULL') and not ElementExists(e, 'DESC') then
Exit;

Expand All @@ -20,13 +23,58 @@ function Process(e: IInterface): integer;
Exit;

// if record overrides several masters, then get the last one
if OverrideCount(m) > 1 then
m := OverrideByIndex(m, OverrideCount(m) - 2);
if MasterCount(m) > 1 then
begin
m := OverrideByIndex(m, OverrideCount(m) - 2);
AddMessage('---------------------------------------------------------------------------------------');
AddMessage('more than one master. Setting master to: '+FullPath(m)+);
end;

if not SameText(GetElementEditValues(e, 'FULL'), GetElementEditValues(m, 'FULL')) then
SetElementEditValues(e, 'FULL', GetElementEditValues(m, 'FULL'));
begin
AddMessage('---------------------------------------------------------------------------------------');
AddMessage('element: '+GetElementEditValues(e, 'FULL')+' ('+ShortName(e)+')');
AddMessage('master: '+GetElementEditValues(m, 'FULL')+' ('+ShortName(m)+')');
if (GetElementEditValues(m, 'FULL') = '') or (GetElementEditValues(m, 'FULL') = ' ') or (GetElementEditValues(m, 'FULL') = 'Creation Club Cell') then
begin
if not (mode = 'test') then
begin
AddMessage('master string EMPTY or master is ''Creation Club Cell'' - not restoring');
end else
AddMessage('TEST MODE - no changes to plugins');

Exit;
end else
begin
if not (mode = 'test') then
begin
SetElementEditValues(e, 'FULL', GetElementEditValues(m, 'FULL'));
AddMessage('restoring FULL string: '+GetElementEditValues(m, 'FULL'));
end else
AddMessage('TEST MODE - no changes to plugins');
end;
end;


if not SameText(GetElementEditValues(e, 'DESC'), GetElementEditValues(m, 'DESC')) then
SetElementEditValues(e, 'DESC', GetElementEditValues(m, 'DESC'));
begin
AddMessage('---------------------------------------------------------------------------------------');
AddMessage('element: '+GetElementEditValues(e, 'DESC')+' ('+ShortName(e)+')');
AddMessage('master: '+GetElementEditValues(m, 'DESC')+' ('+ShortName(m)+')');
if (GetElementEditValues(m, 'DESC') = '') or (GetElementEditValues(m, 'DESC') = ' ') or (GetElementEditValues(m, 'DESC') = 'Creation Club Cell') then
begin
AddMessage('master string EMPTY or master is ''Creation Club Cell'' - not restoring');
Exit;
end else
begin
if not (mode = 'test') then
begin
SetElementEditValues(e, 'DESC', GetElementEditValues(m, 'DESC'));
AddMessage('restoring DESC string: '+GetElementEditValues(m, 'DESC'));
end else
AddMessage('TEST MODE - no changes to plugins');
end;
end;
end;

end.
end.