Advertisement
Guest User

Untitled

a guest
May 27th, 2013
1,014
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.00 KB | None | 0 0
  1. {
  2.   Sometime mods are released for another language, or author accidently
  3.   edited some records and they got saved with a different language.
  4.   This script will copy FULL and DESC subrecords from master to restore original names.
  5. }
  6. unit UserScript;
  7.  
  8. function Process(e: IInterface): integer;
  9. var
  10.   m: IInterface;
  11. begin
  12.   if not ElementExists(e, 'FULL') and not ElementExists(e, 'DESC') then
  13.     Exit;
  14.  
  15.   // get master record
  16.   m := Master(e);
  17.  
  18.   // no master - nothing to restore
  19.   if not Assigned(m) then
  20.     Exit;
  21.  
  22.   // if record overrides several masters, then get the last one
  23.   if OverrideCount(m) > 1 then
  24.     m := OverrideByIndex(m, OverrideCount(m) - 2);
  25.  
  26.   if not SameText(GetElementEditValues(e, 'FULL'), GetElementEditValues(m, 'FULL')) then
  27.     SetElementEditValues(e, 'FULL', GetElementEditValues(m, 'FULL'));
  28.   if not SameText(GetElementEditValues(e, 'DESC'), GetElementEditValues(m, 'DESC')) then
  29.     SetElementEditValues(e, 'DESC', GetElementEditValues(m, 'DESC'));
  30. end;
  31.  
  32. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement