Guest User

ReferencedByIndexBug

a guest
Jan 8th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. {
  2. Run on armor record with non-playable flag to inject unlootable armor
  3. into leveled lists referencing that armor piece
  4. }
  5. unit userscript;
  6.  
  7. uses mtefunctions;
  8. /////////////////////////////////////////////////////////////////////////////////////
  9. function Initialize: integer;
  10. begin
  11. Result := 0;
  12. end;
  13. /////////////////////////////////////////////////////////////////////////////////////
  14. // called for every record selected in xEdit
  15. function Process(e: IInterface): integer;
  16.  
  17. var
  18.  
  19. xstr : string;
  20. i, u, xint : integer;
  21. xMain : IInterface;
  22. entries : IInterface;
  23. xlvl, xcount, xref : string;
  24.  
  25.  
  26. begin
  27. Result := 0;
  28. AddMessage('Processing: ' + FullPath(e));
  29.  
  30. for i := 0 to Pred(ReferencedByCount(e)) do
  31. Begin
  32. xMain := ReferencedByIndex(e, i);
  33. AddMessage('xmain is : ' + FullPath(xMain));
  34. if Signature(xMain) <> 'LVLI' then
  35. Begin
  36. AddMessage('Record Signature not LVLI');
  37. Exit;
  38. End;
  39.  
  40. entries := ElementByName(xMain, 'Leveled List Entries');
  41.  
  42. if not Assigned(entries) then
  43. begin
  44. AddMessage('Entries not assigned');
  45. Exit;
  46. end;
  47.  
  48. for u := 0 to (ElementCount(entries) - 1) do
  49. begin
  50. ent := ElementByIndex(entries, u);
  51. xlvl := GetElementEditValues(ent,'LVLO\Level');
  52. xcount := GetElementEditValues(ent, 'LVLO\Count');
  53. xref := GetElementEditValues(ent, 'LVLO\Reference');
  54. AddMessage('xref is ' + xref);
  55. end;
  56. end;
  57. end;
  58. /////////////////////////////////////////////////////////////////////////////////////
  59. // Called after processing
  60. // You can remove it if script doesn't require finalization code
  61. function Finalize: integer;
  62. begin
  63. Result := 0;
  64. end;
  65.  
  66. end.
Advertisement
Add Comment
Please, Sign In to add comment