Results 1 to 6 of 6

Thread: Useful Functions

  1. #1
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default Useful Functions

    Simba Code:
    function WaitInvCountChange(Time:Integer):Boolean;
    var
      Inv1,Inv2,t:Integer;
    begin
      MarkTime(t);
      Inv1 := InvCount;
      repeat
        wait(10);
        Inv2 := InvCount;
        if TimeFromMark(t) > Time then
        begin
          Result := False;
          Exit;
        end;
      until(Inv2 <> Inv1);
      Result := True;
    end;

    Simba Code:
    function WaitNPCChatText(Text:String; Time:Integer; Action:Variant):Boolean;
    var
      t:Integer;
    begin
      MarkTime(t);
      repeat
        wait(10);
        if TimeFromMark(t) > Time then
        begin
          Result := False;
          Exit;
        end;
      until(FindNPCChatText(Text,Action));
      Result := True;
    end;

    Simba Code:
    function WaitXPIncrease(Time:Integer):Boolean;
    var
      First,Second,t:Integer;
    begin
      First := GetXPBarTotal;
      MarkTime(T);
      repeat
        wait(10);
        Second := GetXPBarTotal;
        if TimeFromMark(t) > Time then
        begin
          Result := False;
          Exit;
        end;
      until(Second > First);
      Result := True;
    end;

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Why have an increase and decrease one when you can make one that does both? As long as the invcount changed then it works for removing and adding.

    Simba Code:
    Function WaitInvChanged(TimeToWait: Integer): Boolean;
    Var
      T, InitCount: Integer;
    begin
      InitCount:= InvCount;
      Result := False;
      T := GetSystemTime + TimeToWait;
      while (GetSystemTime < T) do
      begin
        if (InvCount <> InitCount) then
        begin
          Result := True;
          Exit;
        end;
        Wait(20 + Random(10));
      end;
    end;
    I am Ggzz..
    Hackintosher

  3. #3
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Ah, couldn't remember the sign haha.
    Edited, thanks!

  4. #4
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Another useful one would be waiting for it to change to a specific amount, e.g.
    Simba Code:
    function WaitInvCount(InventCount, Time : Integer) : Boolean;
    var
      Inv, t : Integer;
    begin
      MarkTime(t);
      Inv := InvCount;
      Repeat
        wait(10+Random(10));
        if(Inv <> InvCount)then
          begin
            MarkTime(t);
            Inv := InvCount;
          end;
        if TimeFromMark(t) > Time then
          begin
            Result := False;
            Exit;
          end;
      Until(InventCount = InvCount);
      Result := True;
    end;

  5. #5
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

  6. #6
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    I like the WaitNPCChat one. Now can Invalids and mine kebab buyer be much more efficient

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
  •