Results 1 to 7 of 7

Thread: help finding objects with blacklist

  1. #1
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default help finding objects with blacklist

    I am trying to search for clay in the bank, and what i want to do is store it in as a player integer to use later on, but the way i tried to do it must be wrong because it hovers the top left of the bankscreen/runescape client, the script never finds the clay and i can not figure ot why

    Simba Code:
    function Find_Clay: Boolean;
    var
      i: Integer;
    begin
      for i := 1 to 40 do // the first 4 lines in the bank
      writeln(inttostr(Get_Black_Count(i, SRL_OUTLINE_BLACK, True)));
        if(Get_Black_Count(i, SRL_OUTLINE_BLACK, True) = CLAY_BLACKCOUNT) then
        begin
          Players[CurrentPlayer].Integers[CLAY_BANKSLOT] := i;
          writeln('Player ' + IntToStr(CurrentPlayer) + ' has clay in bankslot '+ inttostr(Players[CurrentPlayer].Integers[CLAY_BANKSLOT]));
          Exit;
        end;
    end;


    {*******************************************************************************
    function Withdraw_Clay: Boolean;
    By: Bonfield
    Description: Deposits soft clay to bank
    *******************************************************************************}

    function Withdraw_Clay: Boolean;
    var
      Max_Time: Integer;
      Index: TPoint;
      Bank_Slot: TBox;
    begin
      if (not LoggedIn) then Exit;
      if (not In_Bank) then Exit;
      Max_Time := GetSystemTime + (2 * 60 * 1000);   // Max time of 2 minutes.
      Open_Bank(WHICH_BANK);
      while (not(Result)) and (GetTimeRunning < Max_Time) do
        begin
          if (Players[CurrentPlayer].Integers[CLAY_BANKSLOT] = 0) then
           Find_Clay else
            begin
              writeln('lolz');
              Index := BankIndexToBankPoint(Players[CurrentPlayer].Integers[CLAY_BANKSLOT]);
              writeln('Index X is ' + IntToStr(Index.X));
              writeln('Index Y is ' + IntToStr(Index.Y));

              Bank_Slot := BankIndexToMSBox(Players[CurrentPlayer].Integers[CLAY_BANKSLOT]);
              MouseBox(Bank_Slot.X1, Bank_Slot.Y1, Bank_Slot.X2, Bank_Slot.Y2, 3);

                if WaitUpTextMulti(['Withdraw-1 c', 'w-1 Clay', 'lay'], 500) then
                  begin
                    Result := True;
                    Withdraw(Index.X, Index.Y, 0);
                    writeln('Withdrew Clay');
                    CloseBank;
                    Exit;
                  end else
                   Result := False;
                   writeln('Withdraw failed CountColor was correct but uptext wasnt');
           end;
        end;
    end;

    EDIT: sorry i didnt now there was a help section
    Last edited by Bonfield; 12-18-2010 at 07:42 AM.



  2. #2
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Did you put the clay in the first bank slot? Because the first bank slot is 0 not one.

    Edit: Is this using MSI?
    Last edited by KingKong; 12-18-2010 at 07:56 AM.

  3. #3
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    no it is in the second, i moved it aroundeg 2, 5, 7 spot to see if that changed anything but it didnt



  4. #4
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Mind posting the function (Get_Black_Count(i, SRL_OUTLINE_BLACK, True))? maybe somethings wrong with that?

  5. #5
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    no problems
    Simba Code:
    function Get_Black_Count(Slot, Color: Integer; Bank: Boolean): Integer;
    var
      b: TBox;
    begin
      Result := 0;
      if Bank then
        b := BankIndexToMSBox(Slot)
      else
        b := InvBox(Slot);
      Result := CountColor(Color, b.X1, b.Y1 + Y_MOD, b.X2, b.Y2);
    end;



  6. #6
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    I think it has problems with finding items in bank, look at this thread:
    http://villavu.com/forum/showthread.php?t=57813

    starting from post 11

    Edit: I think the number of black pixels changes everytime you add or remove any number of clay since it changes the number at top.

  7. #7
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    im pretty sure SRL's constant for the black outline has changed i will look into it more and let you people know

    EDIT: i have added 15 to the y1 part of my search to fix the problem ou mentioned, i can not take credit for that, it was boreas and without his tutorial/post a while back i wouldnt hve known about them

    EDIT 2: i fixed the problem, it was because SRL's black outline was not correct, or i set up runescape wrong, but i also had to rewrite the function am making to withdraw it

    Simba Code:
    function Withdraw_Clay: Boolean;
    var
      i, h,l, Max_Time, x, y: Integer;
      Bank_Slot: TBox;
      SlotsIn: array of Integer;
    begin
      if (not LoggedIn) then Exit;
      if (not In_Bank) then Exit;
      Max_Time := GetSystemTime + (2 * 60 * 1000);   // Max time of 2 minutes.
      Open_Bank(WHICH_BANK);
      while (not(Result)) and (GetTimeRunning < Max_Time) do
        begin
          Count_Items(CLAY_BLACKCOUNT, 1, 50, SlotsIn)
          OutputArray(SlotsIn, 'CLAY_BLACKCOUNT in Bank slots');
          h:= High(SlotsIn);
          l := Length(SlotsIn);
            if (l > 0) then
              begin
                for i:=0 to h do
                  begin
                   Bank_Slot := BankIndexToMSBox(SlotsIn[i]);
                   MouseBox(Bank_Slot.X1, Bank_Slot.Y1, Bank_Slot.X2, Bank_Slot.Y2, 3);
                   wait(500);
                    if WaitUpTextMulti(['Withdraw-1 c', 'w-1 Clay', 'lay'], 1000) then
                       GetMousePos(x,y);
                       Mouse(x, y, 0, 0, false);
                       WaitOption('All', 1000);
                       Players[CurrentPlayer].Integers[CLAY_BANKSLOT] := SlotsIn[i];
                       writeln('Player ' + IntToStr(CurrentPlayer) + ' has clay in bankslot '+ inttostr(Players[CurrentPlayer].Integers[CLAY_BANKSLOT]));
                       exit;
                  end;
               end else
                writeln('SlotsIn Array = 0');
                Result := False;
    end;
    Last edited by Bonfield; 12-18-2010 at 11:34 AM.



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
  •