Results 1 to 9 of 9

Thread: help with inventory function

  1. #1
    Join Date
    Aug 2014
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default help with inventory function

    I'm trying to get InvEmpty to work. I can get DropItem to work. Help is very much appreciated. I //'d out what I wanted it to type initially to try CloseBank like in the example used in the function's description. Here is my code:

    Code:
    program inven;
    {$DEFINE SMART8}
    {$I SRL-OSR/SRL.Simba}
    {$I SRL-OSR/SRL/misc/al_functions.simba}
    {$I SRL-OSR/SRL/Reflection/Reflection.simba}
    {$I SRL-OSR/SRL/misc/SmartGraphics.simba}
    
    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      Players[0].Name :='no';
      Players[0].Pass :='no';
      Players[0].Nick :='no';
      Players[0].Active:=True;
    end;
    
    procedure typeStuff;
    begin
        if InvEmpty then
        CloseBank;
        //TypeSendEx('I have no items', true);
    end;
    
    begin
    SetupSRL;
    SetupReflection;
    ActivateClient;
    DeclarePlayers;
    SMART_ClearCanvas;
    LoginPlayer;
    
    typeStuff;
    
    end.
    Last edited by flappy; 08-27-2014 at 01:56 PM.

  2. #2
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    you should indent and:
    Code:
    Put it like this with the "code" button so people understand it easier

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    what is not working about it?

  4. #4
    Join Date
    Aug 2014
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Robert View Post
    what is not working about it?
    It does not close the bank when inventory is empty, nor does it type anything when I take out the //. I have tried it with if/else statement and it only does the 'else' despite the inventory being empty.

  5. #5
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by flappy View Post
    It does not close the bank when inventory is empty, nor does it type anything when I take out the //. I have tried it with if/else statement and it only does the 'else' despite the inventory being empty.
    try writeln(InvEmpty) and see if it returns true while the bank is open

  6. #6
    Join Date
    Aug 2013
    Posts
    230
    Mentioned
    1 Post(s)
    Quoted
    114 Post(s)

    Default

    Just try If Not(InvFull)

    that works better imo

  7. #7
    Join Date
    Aug 2014
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Robert View Post
    try writeln(InvEmpty) and see if it returns true while the bank is open
    Still returns false, whether bank is open or not.

    Quote Originally Posted by Unfold View Post
    Just try If Not(InvFull)

    that works better imo
    Yeah that works, thanks.

  8. #8
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Seems like the InvEmpty function is broken :s

  9. #9
    Join Date
    Apr 2013
    Location
    United States
    Posts
    39
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    try InvCount=0 or InvCount<1 in place of InvEmpty. It's the same thing.
    Like so:

    Code:
    program inven;
    {$DEFINE SMART8}
    {$I SRL-OSR/SRL.Simba}
    {$I SRL-OSR/SRL/misc/al_functions.simba}
    {$I SRL-OSR/SRL/Reflection/Reflection.simba}
    {$I SRL-OSR/SRL/misc/SmartGraphics.simba}
    
    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      Players[0].Name :='no';
      Players[0].Pass :='no';
      Players[0].Nick :='no';
      Players[0].Active:=True;
    end;
    
    procedure typeStuff;
    begin
        if InvCount=0 then      
        CloseBank;
        //TypeSendEx('I have no items', true);
    end;
    
    begin
    SetupSRL;
    SetupReflection;
    ActivateClient;
    DeclarePlayers;
    SMART_ClearCanvas;
    LoginPlayer;
    
    typeStuff;
    
    end.
    And although you have it commented out, maybe you should either remove the TypeSendEx or replace it with Writeln, because you don't want rs players to notice you keep saying the same thing every time the bank closes.

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
  •