One way would be to change UpdateHooks, and SetupReflectionEx a little bit:
Procedure UpdateHooks(Terminate : Boolean);
var
myFile, ClientRev, RevHook: Integer;
begin
ClientRev := r_GetCurrentGit('clientversion');
RevHook := r_GetCurrentGit('hookrevision');
if (ClientRev = ClientVersion) and (RevHook = HookRev) then
begin
Writeln('[Reflection] No new hooks have been uploaded yet; please be patient!');
if Terminate then
begin
Writeln('[Reflection] Terminating script');
TerminateScript;
end;
Writeln('[Reflection] Running script with outdated hooks');
end;
Writeln('[Reflection] You''re using outdated hooks (version ' + ToStr(ClientVersion) + '.' + ToStr(HookRev) + '); updating you to version' + ToStr(ClientRev) + '.' + ToStr(RevHook) + '!');
myFile := RewriteFile(AppPath + 'includes\reflection\core\hooks.simba', False);
WriteFileString(myFile, GetPage('http://harry.lu/srl/Hooks.txt'));
CloseFile(myFile);
Writeln('[Reflection] Updated you to ' + ToStr(ClientRev) + '.' + ToStr(RevHook) + '; please restart your script!');
TerminateScript;
end;
//SNIP
Procedure SetupReflectionEx(Update, Terminate : Boolean);
begin
SetupConstants;
if(SmartGetFieldInt(0, hook_static_LoginIndex) = -1) then
begin
Writeln('[Reflection] Hooks outdated!');
If Update then
UpdateHooks(Terminate)
else
TerminateScript;
end;
end;
Of course, this would break scripts. To not break scripts,
Terminate could be set as a global var, like MouseSpeed, and by default would be False (which would run on outdated, so set as True in SetupReflectionEx which wouldn't run on outdated hooks [like it does by default ATM]), so if the scripter/user wants to change it, they could do so as a constant in their script, which would be called AFTER SetupReflectionEx.
var
Terminate : Boolean;
Procedure UpdateHooks;
var
myFile, ClientRev, RevHook: Integer;
begin
ClientRev := r_GetCurrentGit('clientversion');
RevHook := r_GetCurrentGit('hookrevision');
if (ClientRev = ClientVersion) and (RevHook = HookRev) then
begin
Writeln('[Reflection] No new hooks have been uploaded yet; please be patient!');
if Terminate then
begin
Writeln('[Reflection] Terminating script');
TerminateScript;
end;
Writeln('[Reflection] Running script with outdated hooks');
end;
Writeln('[Reflection] You''re using outdated hooks (version ' + ToStr(ClientVersion) + '.' + ToStr(HookRev) + '); updating you to version' + ToStr(ClientRev) + '.' + ToStr(RevHook) + '!');
myFile := RewriteFile(AppPath + 'includes\reflection\core\hooks.simba', False);
WriteFileString(myFile, GetPage('http://harry.lu/srl/Hooks.txt'));
CloseFile(myFile);
Writeln('[Reflection] Updated you to ' + ToStr(ClientRev) + '.' + ToStr(RevHook) + '; please restart your script!');
TerminateScript;
end;
//SNIP
Procedure SetupReflectionEx(Update : Boolean);
begin
Terminate:= True;
SetupConstants;
if(SmartGetFieldInt(0, hook_static_LoginIndex) = -1) then
begin
Writeln('[Reflection] Hooks outdated!');
If Update then
UpdateHooks(Terminate)
else
TerminateScript;
end;
end;
Script example:
program Hello;
{.include SRL/SRL.scar}
{.include reflection/reflection.scar}
const
HooksTerminate = False
procedure ScriptyStuff;
begin
//BLA
end;
begin
SetupSRL;
SetupReflectionEx(True);
Terminate:= HooksTerminate;
ScriptyStuff;
end.