SRL Archive - SRL Archives

RandomProcedure(Procedures: TStringArray);


marpis

2009-08-25 18:08:25

I know you don't like 1-line functions, but most scripters (especially jr. members) don't know ThreadSafeCall.

Achtung! Procedures must have no parameters!

RandomProcedure(['MouseAntiban', 'MapAntiban', 'RandomGametab']; // correct
RandomProcedure['MakeCompass(360)', 'MouseBox(msx1, msy1, msx2, msy2, 3)', 'TypeSend(''I am bored'')']); // incorrect


procedure RandomProcedure(Procedures: TStringArray);
var
tmp: TVariantArray;
begin
if not loggedin then exit;
ThreadSafeCall(Procedures[random(length(Procedures))], tmp);
end;

Bixby Sayz

2009-08-26 00:17:08

I wasn't aware SCAR supported multi-threaded execution. The presence of ThreadSafeCall() would indicate that it does??? Is it possible to spawn a second thread? I could see some uses for that.

bullzeye95

2009-08-26 00:32:27

Use CallProc, not ThreadSafeCall.

@Bixby, I don't think the engine is truly multi-threaded.

marpis

2009-08-26 00:55:10

From: bullzeye95
Use CallProc, not ThreadSafeCall.

@Bixby, I don't think the engine is truly multi-threaded.


Never heard of CallProc.
Why?

Gu3st...

2009-08-26 01:00:05

From: marpis
Never heard of CallProc.
Why?

ThreadSafeCall does some nasty stuff to SCAR when called too many times (Can't exactly remember what freddy said)