Results 1 to 3 of 3

Thread: InvEmpty is broken?

  1. #1
    Join Date
    Feb 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default InvEmpty is broken?

    When I run the following block of code it loops through even when my inventory is empty.

    SCAR Code:
    procedure DepositItems;
    begin
      while not(InvEmpty) do
      begin
        Writeln(booltostr(InvEmpty));
        Writeln('Depositing items..');
        OpenBankFast('vwb');
        if (not(BankScreen)) then
        begin
          Writeln('Bank is not open.');
        end;
        DepositAll;
        CloseBank;
      end;
      {**}if (InvEmpty) then DebugMsg('Items deposited into bank.');
    end;

    I looked at the function for InvEmpty and it checks weather the inventory is empty in a completely different way from how InvFull is calculated so I modified the InvFull function to check if the Inv is empty and ended up with this code:

    SCAR Code:
    Function InvEmpty2: Boolean;
    Begin
      GameTab(4);
      Result := InvCount = 0;
    End;


    procedure DepositItems;
    begin
      while not(InvEmpty2) do
      begin
        Writeln(booltostr(InvEmpty2));
        Writeln('Depositing items..');
        OpenBankFast('vwb');
        if (not(BankScreen)) then
        begin
          Writeln('Bank is not open.');
        end;
        DepositAll;
        CloseBank;
      end;
      {**}if (InvEmpty2) then DebugMsg('Items deposited into bank.');
    end;

    Using my function (InvEmpty2) the script runs fine. Why does it not work if I use the standard (InvEmpty) function and also why is InvEmpty calculated in a different way from InvFull?

    To save you checking the InvFull and InvEmpty functions:
    From Includes/SRL/SRL/Core/Inventory.scar
    SCAR Code:
    {*******************************************************************************
    function InvEmpty: Boolean;
    By: WT-Fakawi
    Description: Returns True if inventory is empty
    *******************************************************************************}


    function InvEmpty: Boolean;
    Var
       x, y: integer;
    begin
      GameTab(4);
      Result := not FindColor(x, y, 65536, MIX1, MIY1, MIX2, MIY2);
    end;

    {*******************************************************************************
    function InvFull: Boolean;
    By: n3ss3s
    Description: Returns True if inventory is full
    *******************************************************************************}


    Function InvFull: Boolean;
    Begin
      GameTab(4);
      Result := InvCount = 28;
    End;

  2. #2
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    The InvFull function looks for the static black outline of items in the inventory. That's why it has the FindColor. You could try to do a if then else statement instead of the while do. I don't know why it's not working tho.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  3. #3
    Join Date
    Feb 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok thanks. I don't think that an if then else statement will fix it as it is a problem with InvEmpty. When I print out the value of InvEmpty it says false regardless of weather my inventory is empty or not.

    Seeing how InvEmpty2 works fine I'll just use that untill/unless I find a solution.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Broken down?
    By Shuttleu in forum RuneScape News and General
    Replies: 8
    Last Post: 10-23-2008, 06:48 PM
  2. SRL is Broken?
    By Claymore in forum News and General
    Replies: 13
    Last Post: 10-19-2008, 11:15 PM
  3. Is the SVN Broken?
    By boberman in forum News and General
    Replies: 3
    Last Post: 12-10-2007, 10:03 PM
  4. Broken PS2
    By Birfday_Cake in forum News and General
    Replies: 17
    Last Post: 10-01-2007, 02:33 AM
  5. Need someone with a broken axe.
    By Jason2gs in forum OSR Help
    Replies: 7
    Last Post: 02-28-2007, 05:15 PM

Posting Permissions

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