Results 1 to 5 of 5

Thread: RandomProcedure(Procedures: TStringArray);

  1. #1
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default RandomProcedure(Procedures: TStringArray);

    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!
    SCAR Code:
    RandomProcedure(['MouseAntiban', 'MapAntiban', 'RandomGametab']; // correct
    RandomProcedure['MakeCompass(360)', 'MouseBox(msx1, msy1, msx2, msy2, 3)', 'TypeSend(''I am bored'')']); // incorrect

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

  2. #2
    Join Date
    Aug 2009
    Location
    Nova Scotia, Canada
    Posts
    604
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    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.

  3. #3
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Use CallProc, not ThreadSafeCall.

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

  4. #4
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by bullzeye95 View Post
    Use CallProc, not ThreadSafeCall.

    @Bixby, I don't think the engine is truly multi-threaded.
    Never heard of CallProc.
    Why?

  5. #5
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    Never heard of CallProc.
    Why?
    ThreadSafeCall does some nasty stuff to SCAR when called too many times (Can't exactly remember what freddy said)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •