SRL Archive - Help and Support

simbas equivalent of scriptterminate;


Waddo

2011-08-02 09:41:58

in scar when the program ended or when you called terminate script, it ran a procedure which you could create to free dtms or logout the player or print a progress report, how do you(can you) do this in simba.

program new;

procedure scriptterminate;
begin
writeln('script has ended');
end;

begin
end.

BraK

2011-08-02 09:43:35

SRL has a function like Addonterminate something like that anyway :) I'm sure someone will post with more information.

~BraK

masterBB

2011-08-02 09:49:01

function AddOnTerminate(const proc : string) : boolean;
var
OldProcs : TVariantArray;
i : integer;
begin
result := false;
GetScriptProp(SP_OnTerminate,OldProcs);
for i := 0 to high(OldProcs) do
if lowercase(OldProcs[i]) = lowercase(proc) then
exit;
setlength(OldProcs,Length(OldProcs)+1);
OldProcs[high(OldProcs)] := proc;
SetScriptProp(SP_OnTerminate,oldprocs);
result := True;
end;

Home

2011-08-02 09:50:38

begin
SetScriptProp(SP_OnTerminate, ['ProgressReport']);
Smart_Server := 39;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
end.


~Home

BraK

2011-08-02 12:05:16

From: masterBB
function AddOnTerminate(const proc : string) : boolean;
var
OldProcs : TVariantArray;
i : integer;
begin
result := false;
GetScriptProp(SP_OnTerminate,OldProcs);
for i := 0 to high(OldProcs) do
if lowercase(OldProcs[i]) = lowercase(proc) then
exit;
setlength(OldProcs,Length(OldProcs)+1);
OldProcs[high(OldProcs)] := proc;
SetScriptProp(SP_OnTerminate,oldprocs);
result := True;
end;


Rep+ I can't really look thing up at work right now but I can point it in the Right Direction for others to expand on. Thanks for being my expander :)

~BraK

Waddo

2011-08-02 12:23:41

Could you explain what the parameters are in yours home?

masterBB

2011-08-02 12:28:48

SetScriptProp(SP_OnTerminate, ['ProgressReport']);

SP_OnTerminate is the property you wish to change. This property contains all the the procedures that are called when the script is terminated.

The second parameter is an TVariantArray. In the case of 'SP_OnTerminate' it would also take an Array of String. Just pass it all the function names you wish to be run on terminate.

Nava2

2011-08-02 12:39:51

No, just use AddOnTerminate. It was written for a reason.

Dgby714

2011-08-09 02:30:59

Bored cleaning….

function AddOnTerm(const Proc: string): boolean;
var
Procs: TVariantArray;
lcProc: string;
I, H, L: LongInt;
begin
Result := False;
try
if (GetScriptProp(SP_OnTerminate, Procs)) then
begin
H := High(Procs);
lcProc := Lowercase(Proc);
for I := 0 to H do
if (lcProc = Lowercase(Procs[I])) then
Exit;

L := Length(Procs);
SetLength(Procs, L + 1);
Procs[L] := Proc;

Result := SetScriptProp(SP_OnTerminate, Procs);
end;
except end;
end;