Results 1 to 7 of 7

Thread: How is this even possible?

  1. #1
    Join Date
    Oct 2010
    Posts
    1,255
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default How is this even possible?

    I have a looped banking function, so it will retry after it fails this first time sometimes, but how is this even possible?

    The first part of the function:
    Simba Code:
    function S_WithdrawItem(Item, Amount: Integer; InStack: Boolean): Boolean;
    var
    Start, Tries, TrueAmount, StartInv: Integer;
    begin
    if not(LoggedIn or R_BankScreen) then Exit;
    if(Amount = 0)then TrueAmount := (28 - InvCount)
    else TrueAmount := Amount;
    StartInv := R_CountItemID(Item);
    Debug('Amount: ' + IntToStr(Amount) + '. TrueAmount: ' + IntToStr(TrueAmount));
    Debug('Withdrawing (ID: ' + IntToStr(Item) + ') (Amount: ' + IntToStr(TrueAmount) + ')');


    Output:
    Simba Code:
    Activity[0]: Amount: 0. TrueAmount: 0
    Activity[0]: Withdrawing (ID: 444) (Amount: 0)


    I basically send it:
    S_WithdrawItem(444, 0, False);

    When Amount comes in as 0 (which will withdraw via 'Withdraw-All'), the TrueAmount somehow doesn't get updated sometimes even though I have that block right in front.

    Edit: This is right after a R_DepositAllButID(NatureRune)... I just watched it and I think I need to add a wait because the withdraw still detects the bars immediately after being deposited and InvCount still shows as 28.
    Last edited by smurg; 02-04-2011 at 08:42 PM.
    I'm back

  2. #2
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Yes you do need waits. Probably a while(barsininventory)do wait(250);

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

    Default

    I think you've made a little mistake with:
    if not(LoggedIn or R_BankScreen) then Exit;

    It will only exit if both LoggedIn and R_BankScreen are false!

    if LoggedIn is true and R_BankScreen is false, it won't exit.

    I would change it in:
    if not R_bankScreen then Exit;

    because R_bankScreen is false anyway when you are logged out

  4. #4
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Amfortas View Post
    I think you've made a little mistake with:
    if not(LoggedIn or R_BankScreen) then Exit;

    It will only exit if both LoggedIn and R_BankScreen are false!

    if LoggedIn is true and R_BankScreen is false, it won't exit.

    I would change it in:
    if not R_bankScreen then Exit;

    because R_bankScreen is false anyway when you are logged out
    Other way,
    Or means
    Simba Code:
    if we arent logged in OR we cant find bank screen then exit

  5. #5
    Join Date
    Oct 2010
    Posts
    1,255
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    Quote Originally Posted by Amfortas View Post
    I think you've made a little mistake with:
    if not(LoggedIn or R_BankScreen) then Exit;

    It will only exit if both LoggedIn and R_BankScreen are false!

    if LoggedIn is true and R_BankScreen is false, it won't exit.

    I would change it in:
    if not R_bankScreen then Exit;

    because R_bankScreen is false anyway when you are logged out
    Ooh you're right. Should be an AND, not an OR because they're both inside one NOT.

    Thanks
    I'm back

  6. #6
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    No he isn't right! It's if not LoggedIn or if not R_BankScreen then exit;
    If it were and then what you are saying would be true.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  7. #7
    Join Date
    Oct 2010
    Posts
    1,255
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    not ( LoggedIn or R_BankScreen ) then Exit;

    The not isn't distributive if you use 'OR' inside.

    Simba Code:
    [LEFT][LEFT]LoggedIn = False
    R_BankScreen = False
    Using [COLOR=#0000ff]'OR'[/COLOR] --> Result = False
    [B][COLOR=#000000][B]not[/B][/COLOR][/B]( False ) --> Execute Exit

    LoggedIn = True
    R_BankScreen = False
    Using [COLOR=#0000ff]'OR'[/COLOR] --> Result = True
    [B][COLOR=#000000][B]not[/B][/COLOR][/B]( True ) --> Don't Execute

    LoggedIn = True
    R_BankScreen = True
    Using [COLOR=#0000ff]'
    OR'[/COLOR] --> Result = True
    [B][COLOR=#000000][B]not[/B][/COLOR][/B]( True ) --> Don'
    t Execute
    [/LEFT]
    [/LEFT]
    Simba Code:
    LoggedIn = False
     R_BankScreen = False
     Using [COLOR=#0000ff]'AND'[/COLOR] --> Result = False
     [B][COLOR=#000000][B]not[/B][/COLOR][/B]( False ) --> Execute Exit

    LoggedIn = True
     R_BankScreen = False
     Using [COLOR=#0000ff]'AND'[/COLOR] --> Result = False
     [B][COLOR=#000000][B]not[/B][/COLOR][/B]( False ) --> Execute Exit

    LoggedIn = True
     R_BankScreen = True
     Using [COLOR=#0000ff]'AND'[/COLOR] --> Result = True
     [B][COLOR=#000000][B]not[/B][/COLOR][/B]( True ) --> Don't Execute
    [LEFT][LEFT] [/LEFT][/LEFT]


    Since you can't have the interface R_Bankscreen uses if you aren't logged in..

    So it doesn't execute exit when R_Bankscreen isn't up
    Last edited by smurg; 02-06-2011 at 10:46 PM.
    I'm back

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
  •