SRL Archive - OSR Help

Call a Procedure When Script Stops?


LolL

2011-02-05 17:24:09

Is it possible to make Simba call a certain procedure when the user stops the script manually (i.e., they press the Stop icon or key-in the appropriate hotkeys)? It's like the onFinish method in RSBot. And, if it's not possible in Simba, is it possible in SCAR?

Rich

2011-02-05 17:25:34

In SCAR, there is a procedure called ScriptTerminate. Just use it like a normal procedure, except you don't need to call it anywhere. It'll be called automatically when the script ends. I tried it in Simba before, and it didn't work, so I'm not so sure about Simba.

JPHamlett

2011-02-05 17:26:41

Yup, it's called ScriptTerminate;



Procedure ScriptTerminate;
Begin
//Code here;
End;


Edit : I was wrong and ninja'd haha

Sex

2011-02-05 18:45:26

program new;

procedure wat;
begin
writeln(':]');
end;

begin
SetScriptProp(SP_OnTerminate, ['wat']);
end.

LolL

2011-02-06 20:22:07

Thanks dude, that works perfectly in Simba.

**BANNED The Man

2011-02-07 02:56:57

Or
AddOnTerminate('procedure/function');