Heres the script which is triggered by pause button and starts sit action (in this example) on all listed characters under the Adrenaline control. We already have similar, which triggers script by chat message.
const
TRIGGER_BUTTON = 19; // Pause_Break button
var
myChars: array of string = ['Velmsun', 'Walker'];
procedure MainLoop();
var
KeyCode, i: Integer;
begin
while True do
begin
Engine.WaitAction([laKey], KeyCode, i);
if KeyCode = TRIGGER_BUTTON then begin
SitAll;
end;
end;
end;
procedure SitAll;
var
remoteControl: TL2Control;
i: integer;
begin
for i:=0 to High(myChars) do
begin
remoteControl := GetControl(myChars[i]);
if Assigned(remoteControl) then
begin
remoteControl.Sit;
end;
end;
end;
begin
Script.NewThread(@MainLoop);
delay(-1);
end.
How it works?
Author: Velmsun