Jump to content
  • 0

AutomationTools: Possible to modify multiple leveled list entries?





is it possible to change multiple entries within the same leveled list?


Here's what I'm trying to do:

Change the levels of all entries in this leveled list: https://imgur.com/9LFtai4. I want to change 7 into 20, 9 into 22 and 11 into 25. (to make this mod consistent with WAFR's changes to leveled lists.)


I tried Quick Change and used the Replace function. In the <path> field I entered: Leveled List Entries\Leveled List Entry\LVLO\Level. In the <find> field I entered 7 and in the <replace> field I entered 20. Reapeating the process will turn both 7 in that list into 20. 


problem: Apparantly this only works if the script finds an entry on the top of the list. Once the entries for level 7 are changed, I can't change the other entries. When I try to replace 9 with 22 I get this error message:  !Couldn't find value at path: <Path>Leveled List Entries\Leveled List Entry\LVLO\Level on SublistEnchOrcishBattleAxeFrost


Any suggestions?

Edited by TirigonX
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Yes, what you're looking for is a multiply-indexed path.


I plan on updating QC and QD to support multiply-index paths, but in the meantime I can give you a quick little script, I think.


The script would use ElementsByMIP to get the list of elements whose values we need to change.  So a script could be

unit UserScript;
uses mteFunctions;
  sPath, sFind, sReplace: string;
  Records: TList;
function Initialize: Integer;
  Records := TList.Create;
  sPath := InputBox('Path', 'Enter the path to the elements you want to change', 'Leveled List Entries\[*]\LVLO\Level');
  sFind := InputBox('Find Value', 'Enter the value you want to find', '7');
  sReplace := InputBox('Replace Value', 'Enter the value you want to replace found values with', '20');

function Process(e: IInterface): Integer;
function Finalize: Integer;
  i, j: Integer;
  rec, element: IInterface;
  lst: TList;
  lst := TList.Create;
  for i := 0 to Pred(Records.Count) do begin
    rec := ObjectToElement(Records[i]);
    AddMessage('Processing record '+Name(rec));
    ElementsByMIP(lst, rec, sPath);
    for j := 0 to Pred(lst.Count) do begin
      element := ObjectToElement(lst[j]);
      AddMessage('  Processing element '+IndexedPath(element));
      if GetEditValue(element) = sFind then begin
        AddMessage(Format('    Replacing %s with %s', [sFind, sReplace]));
        SetEditValue(element, sReplace);


I'll test this code and edit the post if it works.

EDIT: Fixed some errors.  It works.

To use this script you'll need to have the latest version of mteFunctions from GitHub.  Right-click and choose save link as on this link: mteFunctions.pas

Edited by Mator
  • +1 1
Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.