Mator

additem batch script generator

Dec 16th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.26 KB | None | 0 0
  1. {
  2.   Generates lists of console commands in the form
  3.     player.additem <formID> <editorID>
  4.   to be executed by the player ingame.
  5.  
  6.   Usage:
  7.   1. Select the items you want to have put into the list.
  8.   2. Apply the script.
  9.   3. Enter the filename you want to use for the output file.
  10.   4. Ingame enter the command bat <filename>, with filename
  11.      being the name of the file you created.
  12. }
  13.  
  14. unit UserScript;
  15.  
  16. uses mteFunctions;
  17.  
  18. const
  19.   pre = 'player.additem';
  20.  
  21. var
  22.   filename, quantity: string;
  23.   output: TStringList;
  24.  
  25. function Initialize: integer;
  26. begin
  27.   filename := InputBox('Enter filename', 'Enter the name you want to use for the output file, excluding file extension.', 'test');
  28.   quantity := InputBox('Enter quantity', 'Enter an integer value for the quantity you want to be added to your inventory.', '1');
  29.   output := TStringList.Create;
  30. end;
  31.  
  32. function Process(e: IInterface): integer;
  33. begin
  34.   if filename = '' then exit;
  35.   output.add(pre + ' ' + HexFormID(e) + ' ' + quantity + ' ' + geev(e, 'EDID'));
  36. end;
  37.  
  38. function Finalize: integer;
  39. var
  40.   path: string;
  41. begin
  42.   if filename = '' then exit;
  43.   path := StringReplace(DataPath, 'Data\', '', [rfReplaceAll]);
  44.   output.SaveToFile(path + filename + '.txt');
  45.   output.Free;
  46. end;
  47.  
  48. end.
Advertisement
Add Comment
Please, Sign In to add comment