SRL Archive - Help

Little questions


Sax

2013-01-17 15:51:44

1. What is the predefined MouseSpeed?

2. how the function AddOnTerminate works?

Thanks :D

Kyle Undefined

2013-01-17 16:01:11

1. I have no clue, totally forgot.

2. Whenever the script terminates, it will call that method. Use it like so:

procedure printMe;
begin
WriteLn('Printed!');
end;

...

AddOnTerminate('printMe');

Kevin

2013-01-17 16:05:48

When he says terminated, he means in any manner. Naturally, script exception, force shutdown (stop button at least). I also don't know the mouse speed…

Sax

2013-01-17 16:06:58

That only works when the script is terminated properly right? When an error occurs that function is not called?

Where should I place the addonterminate in the script?

Sin

2013-01-17 16:07:07

18 is default iirc.

Sax

2013-01-17 16:17:18

I found at srl.simba I guess it is 15

Kevin

2013-01-17 16:41:58

Place the AddOnTerminate as early on in your program as you can that is also helpful. It only needs to be called once (for each method you want it to act on) per run.

IE: typical use is to have a method that frees all DTMs and call the AddOnTerminate on that. But no sense in having it possibly run before the DTMs are created so something along these lines:

procedure DeclareDTMs;
begin
DTMa:= DtmFromString('fhdwuiafghiaoh');
DTMb:= DtmFromString('fhdwwfafwauiafghiaoh');
DTMc:= DtmFromString('fhdwuiafghiagawgwagasoh');
end;

procedure FreeMyDTMs;
begin
Free(DTMa);
Free(DTMb);
Free(DTMc);
end;

begin
SetupSRL;
DeclareDTMs;
AddOnTerminate('FreeMyDTMs');//Notice the name of the method is in quotation marks.
repeat
dostuff;
until(ReasonToEnd);
end.

Kyle Undefined

2013-01-18 18:50:46

If the script errors out, then the AddOnTerminate method will not be called. Only if the script completes, or is manually turned off, with that be called.

Ian

2013-01-18 19:57:21

From: Kyle Undefined
If the script errors out, then the AddOnTerminate method will not be called. Only if the script completes, or is manually turned off, with that be called.


If I call TerminateScript that would count as completing right?

The Killer

2013-01-18 19:59:42

From: Sin
18 is default iirc.


From: Nirvana
I found at srl.simba I guess it is 15


Yeah I think it's 15.

i luffs yeww

2013-01-18 20:08:30

From: BMWxi
If I call TerminateScript that would count as completing right?


Yes.

Ian

2013-01-18 20:25:45

From: i luffs yeww
Yes.


Thanks. Also there are a lot of inactive people returning. :D