Results 1 to 4 of 4

Thread: MultiUTWait, and UTWait.

  1. #1
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default MultiUTWait, and UTWait.

    Both ideas came from Narcle's scripts... ANYWAYS

    Here is the code I use:

    SCAR Code:
    //Waits until the required uptext appears. Max of 500 Original Credits to munk.
    function MultiUTWait(Texts: TStringArray): Boolean;

    var
      iTime: Integer;
     
    begin
      iTime := GetTimeRunning + 500;
      Result := StrInArr(GetUpText, Texts);
      while (iTime > GetTimeRunning) and not (Result) do
      begin
        Wait(RandomRange(10, 50));
        Result := StrInArr(RS_GetUpText, Texts);
      end;
    end;

    // See MultiUTWait
    function UTWait(Text: String): Boolean;
    begin
      Result := MultiUTWait([Text]);
    end;

    So, it waits a max of 500ms for the correct uptext to appear. Otherwise, it will return false.

    This allows for lag w/ computers!

    Comments?

    Also, I attached the string array functions of Narcle's. They should be added...

    SCAR Code:
    //Narcle
    function StrInArr(str : string; arrS : TStringArray) : Boolean;

    var
      I, L, H: Integer;

    begin
      Result := True;
      Str := LowerCase(Str);
      L := Low(arrS);    H := High(arrS);
      for I := L to H do
        if Pos(Str, LowerCase(arrS[I])) > 0 then
          Exit;
      Result := False;
    end;

    //Narcle
    function ArrInStr(arrS : TStringArray; str : string) : Boolean;

    var
      I, L, H: Integer;

    begin
      Result := True;
      Str := LowerCase(Str);
      L := Low(arrS);    H := High(arrS);
      for I := L to H do
        if Pos(LowerCase(arrS[I]), Str) > 0 then
          Exit;
      Result := False;
    end;

    //Narcle
    function CombineStrArray(Ar1, Ar2: TStringArray): TStringArray;
    var
      Temp: TStringArray;
      L, H, i: integer;
    begin
      SetArrayLength(Temp, Length(Ar1) + Length(Ar2));
      L := Low(Ar1);
      H := High(Ar1);
      For i := L to H do
        Temp[i] := Ar1[i];
      L := H + 1;
      H := High(Temp);
      for i := L to H do
        Temp[i] := Ar2[i-L];
      Result := Temp;
    end;
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  2. #2
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    UTWait is originally munks (mines a bit different), I made MultiUTWait based off that.

    I believe StrInArr is already in, cept it requires a var to return the point which it was found - think its n3ss3s's.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  3. #3
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Nah, InStrArr is different, it checks for the exact occurance, rather than yours which use a Pos check.

    And I will add munk's credit.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  4. #4
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Nah, InStrArr is different, it checks for the exact occurance, rather than yours which use a Pos check.

    And I will add munk's credit.
    Ah I see, was wondering about that.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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
  •