Repeat dialog clicks at other chars

Repeats dialog actions (clicks) at other chars under Adrenaline

 const
  DialogRepeatEnable: boolean = true; // repeat dialogs, true(yes) / false(no)
  
  DialogRepeatPlayerList: array of string = ['test12', 'mana']; // Add the names of the chars who will follow the actions
  OpcodeStr = '21'; 
  OpcodeHex = $21;

procedure OnCliPacket(ID1, ID2: Cardinal; Data: Pointer; Size: Word);
begin
  if (DialogRepeatEnable) and (ID1 = OpcodeHex) then   
    DialogRepeat(MemToHex(Data^, Size));              
end;

procedure DialogRepeat(PacketData: string);
var 
  E: TL2Control;
  i: integer;
begin
  for i:= 0 to Length(DialogRepeatPlayerList)-1 do begin         
    E:= nil;
    E:= GetControl(DialogRepeatPlayerList[i]);                  
    if (E <> nil) then E.SendToServer(OpcodeStr + PacketData);   
  end;
end;

procedure DialogOpen(E: TL2Control);    
begin
  E.SetTarget(User.Target.ID);
  E.DlgOpen;
end;

procedure DialogOpenThread();           
var
  p1, p2: integer;
  i: integer;
  E: TL2Control;
  LastTargetID: cardinal;               
  LastDlgText: string;                 
begin
  Engine.SendActID(1);                   
  while (true) do begin                       
    Engine.WaitAction([laDlg], p1, p2);      
    while (User.Target.ID = LastTargetID) and (Engine.DlgText <> LastDlgText) do delay(10);
    for i:= 0 to Length(DialogRepeatPlayerList)-1 do begin   
      E:= nil;
      E:= GetControl(DialogRepeatPlayerList[i]);    
      if (E <> nil) then       
        Script.NewThread(@DialogOpen(E));
    end;
    LastTargetID:= User.Target.ID;
    LastDlgText:= Engine.DlgText;
  end;
end;

begin
  if (DialogRepeatEnable) then
    Script.NewThread(@DialogOpenThread); 
    
  Delay(-1);
end.

How this script works?

Script requires paid adrenaline

Author: Velmsun