SRL Archive - OSR Help

How is this even possible?


smurg

2011-02-04 15:40:17

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:
[LEFT]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) + ')');
[/LEFT]


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


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.

mormonman

2011-02-04 16:21:13

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

Amfortas

2011-02-06 10:50:07

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

**BANNED The Man

2011-02-06 10:55:49

From: Amfortas
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
 if we arent logged in OR we cant find bank screen then exit

smurg

2011-02-06 15:48:06

From: Amfortas
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 :)

Sex

2011-02-06 15:54:36

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.

smurg

2011-02-06 17:39:14

not ( LoggedIn or R_BankScreen ) then Exit;

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


[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]



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