Results 1 to 17 of 17

Thread: GetBankItemAmount(const Row, Col: Integer): Integer;

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

    Default GetBankItemAmount(const Row, Col: Integer): Integer;

    The Rows and Columns are switched.

    Say I have a bank setup with items numbering:

    7 1 3 5 6
    4 5 2 8 9

    GetBankItemAmount(1, 0); would return 1.
    GetBankItemAmount(0, 1); would return 4.

    This is backwards. Of course it employs other functions too so I'm not sure how far down the line they're backwards.

    Thanks
    I'm back

  2. #2
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Support, from the looks of it, I think it's just the (row, col) needs to be switched around to (col, row)? [As far back as needed to edit]
    Simba Code:
    function BankIndexToMSPoint(Index: Integer): TPoint;
    begin
      Index := Index - 1;
      Result := Point(38 + (Index mod 10) * 44, 90 + Floor(Index div 10) * 45);
    end;


    function BankIndexToMSBox(Index: Integer): TBox;
    var
       P: TPoint;
    begin
      P := BankIndexToMSPoint(Index);
      Result.X1 := P.X;
      Result.Y1 := P.Y;
      Result.X2 := Result.X1 + 31;
      Result.Y2 := Result.Y1 + 32;
    end;


    function GetBankIndexItemAmount(const Index: Integer): Integer;
    begin
      Result := getAmountBox(BankIndexToMSBox(Index));
    end;

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

    Default

    Could you go into Bank.simba and change BankPointToBankIndex to

    Simba Code:
    function BankPointToBankIndex(P: TPoint): Integer;
    begin
      Result := P.X * 10 + P.Y + 1;
    end;

    It's printing the correct values now, but I don't want to commit this yet. I don't know if it was really that easy of a fix.
    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.


  4. #4
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    With that simple change, I recieved all correct amounts;
    Simba Code:
    Program New;
    {$DEFINE SRL5}
    {$i srl/srl.simba}
    //GetBankItemAmount(const Row, Col: Integer): Integer;
    Begin
    SetupSRL;
    WriteLn(GetBankItemAmount(0,0));
    WriteLn(GetBankItemAmount(0,1));
    WriteLn(GetBankItemAmount(1,0));
    WriteLn(GetBankItemAmount(1,1));
    End.

    Gave Me:
    Code:
    10
    5
    100
    15
    (all of which were the correct slots, and number amounts)
    Last edited by Le Jingle; 05-19-2012 at 08:50 AM.

  5. #5
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by irc
    (22:36:33) Narcle: oh that... yeah i recall it
    (22:36:33) Ninja`: Which was backwards and gave the wrong slot
    (22:36:49) Narcle: someone did it weird long time ago
    (22:36:56) Narcle: you have to read the text that is used in the function
    (22:37:04) Narcle: GetBankItemAmount(const Row, Col: Integer)
    (22:37:08) Narcle: Row, Col
    (22:37:13) Narcle: ... yeah idk why it was done that way
    (22:37:19) Narcle: but it would break way to much shit atm
    ^^^ would unfortunately break way too much atm to change, not to mention all scripts using these.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    What Narcle said, and you'd have to manually update the code on your side if you want it to work correctly, for now.
    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.


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

    Default

    But couldn't you just flip-flop the description and variables in use so that they are the correct labels at least?
    I'm back

  8. #8
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by smurg View Post
    But couldn't you just flip-flop the description and variables in use so that they are the correct labels at least?
    GetBankItemAmount(const Row, Col: Integer): Integer;

    Row ===============

    Col (column)
    ||
    ||
    ||
    ||
    ||
    ||

    "They are correct." Pain in the ass isn't it? I know I looked into it a while ago and was like /facepalm. I wanted to change it then but it would break to much.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    Quote Originally Posted by Narcle View Post
    GetBankItemAmount(const Row, Col: Integer): Integer;

    Row ===============

    Col (column)
    ||
    ||
    ||
    ||
    ||
    ||

    "They are correct." Pain in the ass isn't it? I know I looked into it a while ago and was like /facepalm. I wanted to change it then but it would break to much.
    Rows are horizontal and columns are vertical.

    Rows change values vertically and columns change values horizontally.

    (Row, Column) would go like this:

    Code:
    (0, 0)(0, 1)(0, 2)(0, 3)(0, 4)(0, 5)
    (1, 0)(1, 1)(1, 2)(1, 3)(1, 4)(1, 5)
    (2, 0)(2, 1)(2, 2)(2, 3)(2, 4)(2, 5)
    (3, 0)(3, 1)(3, 2)(3, 3)(3, 4)(3, 5)
    I'm back

  10. #10
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by smurg View Post
    Rows are horizontal and columns are vertical.

    Rows change values vertically and columns change values horizontally.
    Uh yea... Think about it again.

    Rows:
    0 --------
    1 --------
    2 --------
    3 --------
    4 --------

    Columns
    0 1 2 3 4 5
    | | | | | |
    | | | | | |
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    Quote Originally Posted by Narcle View Post
    Uh yea... Think about it again.

    Rows:
    0 --------
    1 --------
    2 --------
    3 --------
    4 --------

    Columns
    0 1 2 3 4 5
    | | | | | |
    | | | | | |
    Yes, that's what i explained in my OP and in the last post.

    The function is currently backwards.
    I'm back

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

    Default

    Can you test the function? You'll see what I mean.
    I'm back

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

    Default

    I know what you mean, and I've tested it. I even have a fix for it, but it will break way too much stuff.
    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.


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

    Default

    I mean just now, my suggestion would be to change the description around, like the variables Row and Col in the parameters.
    I'm back

  15. #15
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    418
    Mentioned
    2 Post(s)
    Quoted
    86 Post(s)

    Default

    Did this get fixed? Still using my own method but may use this soon.

  16. #16
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Blakebn2011 View Post
    Did this get fixed? Still using my own method but may use this soon.
    There is nothing wrong with the function, except that the labels are cognitively wrong. Just swap the parameter and it'd work perfectly.

  17. #17
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    I got problems with DepositAll, it doesnt work for me and I did this simple line
    if InvEmpty then Writeln('yes');
    and its saying yes all the time so simba doesnt know my inv have items in it :/

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
  •